Skip to content

Commit

Permalink
style: use shorter line length
Browse files Browse the repository at this point in the history
  • Loading branch information
EdJoPaTo committed Nov 27, 2023
1 parent 9c6c31b commit 01d87f2
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
9 changes: 7 additions & 2 deletions source/bot/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import type {MyContext, Session} from './my-context.js';
dotenv(); // Load from .env file
const token = env['BOT_TOKEN'];
if (!token) {
throw new Error('You have to provide the bot-token from @BotFather via environment variable (BOT_TOKEN)');
throw new Error(
'You have to provide the bot-token from @BotFather via environment variable (BOT_TOKEN)',
);
}

const bot = new Bot<MyContext>(token);
Expand Down Expand Up @@ -54,7 +56,10 @@ bot.command('html', async ctx => {

const menuMiddleware = new MenuMiddleware('/', menu);
bot.command('start', async ctx => menuMiddleware.replyToContext(ctx));
bot.command('settings', async ctx => menuMiddleware.replyToContext(ctx, '/settings/'));
bot.command(
'settings',
async ctx => menuMiddleware.replyToContext(ctx, '/settings/'),
);
bot.use(menuMiddleware.middleware());

// False positive as bot is not a promise
Expand Down
9 changes: 7 additions & 2 deletions source/bot/menu/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ import {MenuTemplate} from 'grammy-inline-menu';
import type {MyContext} from '../my-context.js';
import {menu as settingsMenu} from './settings/index.js';

export const menu = new MenuTemplate<MyContext>(ctx => ctx.t('welcome', {name: ctx.from!.first_name}));
export const menu = new MenuTemplate<MyContext>(ctx =>
ctx.t('welcome', {name: ctx.from!.first_name}),
);

menu.url('Telegram API Documentation', 'https://core.telegram.org/bots/api');
menu.url('grammY Documentation', 'https://grammy.dev/');
menu.url('Inline Menu Documentation', 'https://github.com/EdJoPaTo/grammy-inline-menu');
menu.url(
'Inline Menu Documentation',
'https://github.com/EdJoPaTo/grammy-inline-menu',
);

menu.submenu(ctx => '⚙️' + ctx.t('menu-settings'), 'settings', settingsMenu);
4 changes: 3 additions & 1 deletion source/bot/menu/settings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import {backButtons} from '../general.js';
import type {MyContext} from '../../my-context.js';
import {menu as languageMenu} from './language.js';

export const menu = new MenuTemplate<MyContext>(ctx => ctx.t('settings-body'));
export const menu = new MenuTemplate<MyContext>(ctx =>
ctx.t('settings-body'),
);

menu.submenu(ctx => '🏳️‍🌈' + ctx.t('menu-language'), 'lang', languageMenu);

Expand Down
4 changes: 3 additions & 1 deletion source/bot/menu/settings/language.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import {backButtons} from '../general.js';
import {getAvailableLocales} from '../../../translation.js';
import type {MyContext} from '../../my-context.js';

export const menu = new MenuTemplate<MyContext>(ctx => ctx.t('settings-language'));
export const menu = new MenuTemplate<MyContext>(ctx =>
ctx.t('settings-language'),
);

menu.select('lang', getAvailableLocales, {
isSet: async (ctx, key) => await ctx.i18n.getLocale() === key,
Expand Down
4 changes: 3 additions & 1 deletion source/magic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ export function feedTheDragons(): void {
// Like feeding dragons before you can fight them all day long.
console.log('Feed the dragons…');

console.log('Looks like they arnt hungry anymore. But somehow the poeple helping you transporting the food are gone too…');
console.log(
'Looks like they arnt hungry anymore. But somehow the poeple helping you transporting the food are gone too…',
);
}

export function fightDragons(): string {
Expand Down

0 comments on commit 01d87f2

Please sign in to comment.