From 9f7412df6b2c1e642911526a71c43a27b9e4194b Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Sat, 23 Aug 2025 17:50:47 +0300 Subject: [PATCH] refactor: update bot feature integration to explicitly register welcome, download, and unhandled features; improve code clarity --- apps/bot/src/bot/features/index.ts | 1 + apps/bot/src/bot/features/unhandled.ts | 2 +- apps/bot/src/bot/index.ts | 9 +++------ 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/apps/bot/src/bot/features/index.ts b/apps/bot/src/bot/features/index.ts index 994439c..b791d7a 100644 --- a/apps/bot/src/bot/features/index.ts +++ b/apps/bot/src/bot/features/index.ts @@ -1,2 +1,3 @@ export * from './download'; +export * from './unhandled'; export * from './welcome'; diff --git a/apps/bot/src/bot/features/unhandled.ts b/apps/bot/src/bot/features/unhandled.ts index b376890..281e83e 100644 --- a/apps/bot/src/bot/features/unhandled.ts +++ b/apps/bot/src/bot/features/unhandled.ts @@ -14,4 +14,4 @@ feature.on('callback_query', logHandle('unhandled-callback-query'), (ctx) => { return ctx.answerCallbackQuery(); }); -export { composer as unhandledFeature }; +export { composer as unhandled }; diff --git a/apps/bot/src/bot/index.ts b/apps/bot/src/bot/index.ts index 48b976b..8f02276 100644 --- a/apps/bot/src/bot/index.ts +++ b/apps/bot/src/bot/index.ts @@ -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; }