mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2025-01-11 14:48:10 +03:00
fix(explorer): get bot on module init
This commit is contained in:
parent
f13eebe685
commit
8fcec73afd
@ -15,8 +15,8 @@ import { getBotToken } from '../utils';
|
||||
export class ListenersExplorerService
|
||||
extends BaseExplorerService
|
||||
implements OnModuleInit {
|
||||
private readonly bot: Telegraf<any>;
|
||||
private readonly stage = new Stage([]);
|
||||
private bot: Telegraf<any>;
|
||||
|
||||
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<Telegraf<never>>(botToken);
|
||||
this.bot.use(this.stage.middleware());
|
||||
}
|
||||
|
||||
onModuleInit(): void {
|
||||
const botToken = getBotToken(this.telegrafOptions.name);
|
||||
this.bot = this.moduleRef.get<Telegraf<never>>(botToken);
|
||||
this.bot.use(this.stage.middleware());
|
||||
|
||||
this.explore();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user