fix: use message('text') filter for Telegraf v4 setup reply handler

This commit is contained in:
2026-05-20 19:47:30 +02:00
parent e64010591a
commit ef75e79274
+3 -3
View File
@@ -1,4 +1,5 @@
import { Telegraf } from 'telegraf'; import { Telegraf } from 'telegraf';
import { message } from 'telegraf/filters';
import type { Database } from 'better-sqlite3'; import type { Database } from 'better-sqlite3';
import { handleLog } from './commands/log'; import { handleLog } from './commands/log';
import { handleSkip } from './commands/skip'; import { handleSkip } from './commands/skip';
@@ -30,9 +31,8 @@ export function createBot(token: string, chatId: string, db: Database): Telegraf
bot.command('setup', handleSetup(db)); bot.command('setup', handleSetup(db));
const setupReply = handleSetupReply(db); const setupReply = handleSetupReply(db);
bot.on('text', async (ctx) => { bot.on(message('text'), async (ctx) => {
const text = (ctx.message as { text?: string })?.text ?? ''; if (ctx.message.text.startsWith('/')) return;
if (text.startsWith('/')) return;
await setupReply(ctx); await setupReply(ctx);
}); });