refactor: update bot feature integration to explicitly register welcome, download, and unhandled features; improve code clarity

This commit is contained in:
vchikalkin 2025-08-23 17:50:47 +03:00
parent 8d0c1f6d2b
commit 9f7412df6b
3 changed files with 5 additions and 7 deletions

View File

@ -1,2 +1,3 @@
export * from './download';
export * from './unhandled';
export * from './welcome';

View File

@ -14,4 +14,4 @@ feature.on('callback_query', logHandle('unhandled-callback-query'), (ctx) => {
return ctx.answerCallbackQuery();
});
export { composer as unhandledFeature };
export { composer as unhandled };

View File

@ -1,7 +1,6 @@
/* eslint-disable n/callback-return */
import { type Context } from './context';
import * as features from './features';
import { unhandledFeature } from './features/unhandled';
import { errorHandler } from './handlers/errors';
import { i18n } from './i18n';
import * as middlewares from './middlewares';
@ -68,11 +67,9 @@ export function createBot({ apiRoot, token }: Parameters_) {
protectedBot.use(autoChatAction(bot.api));
protectedBot.use(hydrate());
for (const feature of Object.values(features)) {
protectedBot.use(feature);
}
protectedBot.use(unhandledFeature);
protectedBot.use(features.welcome);
protectedBot.use(features.download);
protectedBot.use(features.unhandled);
return bot;
}