From 8fcec73afd186ad84d37b0cd16ab2a8a0014838f Mon Sep 17 00:00:00 2001 From: Morb0 Date: Sun, 3 Jan 2021 16:20:50 +0300 Subject: [PATCH] fix(explorer): get bot on module init --- lib/services/listeners-explorer.service.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/services/listeners-explorer.service.ts b/lib/services/listeners-explorer.service.ts index 2558334..eb0b789 100644 --- a/lib/services/listeners-explorer.service.ts +++ b/lib/services/listeners-explorer.service.ts @@ -15,8 +15,8 @@ import { getBotToken } from '../utils'; export class ListenersExplorerService extends BaseExplorerService implements OnModuleInit { - private readonly bot: Telegraf; private readonly stage = new Stage([]); + private bot: Telegraf; constructor( @Inject(TELEGRAF_MODULE_OPTIONS) @@ -28,13 +28,13 @@ export class ListenersExplorerService private readonly modulesContainer: ModulesContainer, ) { super(); - - const botToken = getBotToken(this.telegrafOptions.name); - this.bot = this.moduleRef.get>(botToken); - this.bot.use(this.stage.middleware()); } onModuleInit(): void { + const botToken = getBotToken(this.telegrafOptions.name); + this.bot = this.moduleRef.get>(botToken); + this.bot.use(this.stage.middleware()); + this.explore(); }