mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2024-12-24 15:04:38 +03:00
do not launch bot if launchOptions are defined as 'false'
This commit is contained in:
parent
3d33b34841
commit
3f4b9ce4ed
@ -5,7 +5,7 @@ export interface TelegrafModuleOptions {
|
||||
token: string;
|
||||
botName?: string;
|
||||
options?: Partial<Telegraf.Options<any>>;
|
||||
launchOptions?: Telegraf.LaunchOptions;
|
||||
launchOptions?: Telegraf.LaunchOptions | false;
|
||||
include?: Function[];
|
||||
middlewares?: ReadonlyArray<Middleware<any>>;
|
||||
}
|
||||
|
@ -7,7 +7,10 @@ export async function createBotFactory(
|
||||
const bot = new Telegraf<any>(options.token, options.options);
|
||||
|
||||
bot.use(...(options.middlewares ?? []));
|
||||
await bot.launch(options.launchOptions);
|
||||
|
||||
if (options.launchOptions !== false) {
|
||||
await bot.launch(options.launchOptions);
|
||||
}
|
||||
|
||||
return bot;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user