mirror of
https://github.com/whekin/household-bot.git
synced 2026-03-31 23:34:04 +00:00
feat(bot): add Telegram bot i18n foundation
This commit is contained in:
@@ -1,17 +1,20 @@
|
||||
import { Bot } from 'grammy'
|
||||
import type { Logger } from '@household/observability'
|
||||
|
||||
import { botLocaleFromContext, getBotTranslations } from './i18n'
|
||||
import { formatTelegramHelpText } from './telegram-commands'
|
||||
|
||||
export function createTelegramBot(token: string, logger?: Logger): Bot {
|
||||
const bot = new Bot(token)
|
||||
|
||||
bot.command('help', async (ctx) => {
|
||||
await ctx.reply(formatTelegramHelpText())
|
||||
const locale = botLocaleFromContext(ctx)
|
||||
await ctx.reply(formatTelegramHelpText(locale))
|
||||
})
|
||||
|
||||
bot.command('household_status', async (ctx) => {
|
||||
await ctx.reply('Household status is not connected yet. Data integration is next.')
|
||||
const locale = botLocaleFromContext(ctx)
|
||||
await ctx.reply(getBotTranslations(locale).bot.householdStatusPending)
|
||||
})
|
||||
|
||||
bot.catch((error) => {
|
||||
|
||||
Reference in New Issue
Block a user