refactor: update bot feature integration to explicitly register welcome, download, and unhandled features; improve code clarity
This commit is contained in:
parent
8d0c1f6d2b
commit
9f7412df6b
@ -1,2 +1,3 @@
|
||||
export * from './download';
|
||||
export * from './unhandled';
|
||||
export * from './welcome';
|
||||
|
||||
@ -14,4 +14,4 @@ feature.on('callback_query', logHandle('unhandled-callback-query'), (ctx) => {
|
||||
return ctx.answerCallbackQuery();
|
||||
});
|
||||
|
||||
export { composer as unhandledFeature };
|
||||
export { composer as unhandled };
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user