fix: use message('text') filter for Telegraf v4 setup reply handler
This commit is contained in:
+3
-3
@@ -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);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user