From ef75e79274e86d488eaac89ffd1127f3e492cc36 Mon Sep 17 00:00:00 2001 From: Sjoerd de Vries Date: Wed, 20 May 2026 19:47:30 +0200 Subject: [PATCH] fix: use message('text') filter for Telegraf v4 setup reply handler --- src/bot/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bot/index.ts b/src/bot/index.ts index 4f4a03e..1a8c863 100644 --- a/src/bot/index.ts +++ b/src/bot/index.ts @@ -1,4 +1,5 @@ import { Telegraf } from 'telegraf'; +import { message } from 'telegraf/filters'; import type { Database } from 'better-sqlite3'; import { handleLog } from './commands/log'; import { handleSkip } from './commands/skip'; @@ -30,9 +31,8 @@ export function createBot(token: string, chatId: string, db: Database): Telegraf bot.command('setup', handleSetup(db)); const setupReply = handleSetupReply(db); - bot.on('text', async (ctx) => { - const text = (ctx.message as { text?: string })?.text ?? ''; - if (text.startsWith('/')) return; + bot.on(message('text'), async (ctx) => { + if (ctx.message.text.startsWith('/')) return; await setupReply(ctx); });