mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2025-01-25 21:31:07 +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
|
export class ListenersExplorerService
|
||||||
extends BaseExplorerService
|
extends BaseExplorerService
|
||||||
implements OnModuleInit {
|
implements OnModuleInit {
|
||||||
private readonly bot: Telegraf<any>;
|
|
||||||
private readonly stage = new Stage([]);
|
private readonly stage = new Stage([]);
|
||||||
|
private bot: Telegraf<any>;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(TELEGRAF_MODULE_OPTIONS)
|
@Inject(TELEGRAF_MODULE_OPTIONS)
|
||||||
@ -28,13 +28,13 @@ export class ListenersExplorerService
|
|||||||
private readonly modulesContainer: ModulesContainer,
|
private readonly modulesContainer: ModulesContainer,
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
const botToken = getBotToken(this.telegrafOptions.name);
|
|
||||||
this.bot = this.moduleRef.get<Telegraf<never>>(botToken);
|
|
||||||
this.bot.use(this.stage.middleware());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onModuleInit(): void {
|
onModuleInit(): void {
|
||||||
|
const botToken = getBotToken(this.telegrafOptions.name);
|
||||||
|
this.bot = this.moduleRef.get<Telegraf<never>>(botToken);
|
||||||
|
this.bot.use(this.stage.middleware());
|
||||||
|
|
||||||
this.explore();
|
this.explore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user