mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2024-12-24 23:14:39 +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;
|
token: string;
|
||||||
botName?: string;
|
botName?: string;
|
||||||
options?: Partial<Telegraf.Options<any>>;
|
options?: Partial<Telegraf.Options<any>>;
|
||||||
launchOptions?: Telegraf.LaunchOptions;
|
launchOptions?: Telegraf.LaunchOptions | false;
|
||||||
include?: Function[];
|
include?: Function[];
|
||||||
middlewares?: ReadonlyArray<Middleware<any>>;
|
middlewares?: ReadonlyArray<Middleware<any>>;
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,10 @@ export async function createBotFactory(
|
|||||||
const bot = new Telegraf<any>(options.token, options.options);
|
const bot = new Telegraf<any>(options.token, options.options);
|
||||||
|
|
||||||
bot.use(...(options.middlewares ?? []));
|
bot.use(...(options.middlewares ?? []));
|
||||||
|
|
||||||
|
if (options.launchOptions !== false) {
|
||||||
await bot.launch(options.launchOptions);
|
await bot.launch(options.launchOptions);
|
||||||
|
}
|
||||||
|
|
||||||
return bot;
|
return bot;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user