feat: implement feedback collection system with quest-based interaction

This commit is contained in:
2025-11-16 00:07:41 +07:00
parent 8b83c15ab1
commit 8754c2b460
23 changed files with 963 additions and 1141 deletions

18
src/bot.ts Normal file
View File

@@ -0,0 +1,18 @@
import type { FeedbackStore } from './stores/feedback';
import type { SessionStore } from './stores/session';
import { Telegraf } from 'telegraf';
import { onCallback, onStart } from './telegram/handlers';
export function createBot(token: string, rootDir: string, sessions: SessionStore, feedback: FeedbackStore, signal: AbortSignal): Telegraf {
const bot = new Telegraf(token, { handlerTimeout: 10_000 });
bot.start(onStart(rootDir, sessions));
bot.on('callback_query', onCallback(rootDir, sessions, feedback));
// Graceful shutdown
signal.addEventListener('abort', () => {
bot.stop('AbortController: abort');
});
return bot;
}