diff --git a/lib/interfaces/telegraf-options.interface.ts b/lib/interfaces/telegraf-options.interface.ts index 7fccf05..f8f6b74 100644 --- a/lib/interfaces/telegraf-options.interface.ts +++ b/lib/interfaces/telegraf-options.interface.ts @@ -5,7 +5,7 @@ export interface TelegrafModuleOptions { token: string; botName?: string; options?: Partial>; - launchOptions?: Telegraf.LaunchOptions; + launchOptions?: Telegraf.LaunchOptions | false; include?: Function[]; middlewares?: ReadonlyArray>; } diff --git a/lib/utils/create-bot-factory.util.ts b/lib/utils/create-bot-factory.util.ts index 5eb4f8f..f1ae787 100644 --- a/lib/utils/create-bot-factory.util.ts +++ b/lib/utils/create-bot-factory.util.ts @@ -7,7 +7,10 @@ export async function createBotFactory( const bot = new Telegraf(options.token, options.options); bot.use(...(options.middlewares ?? [])); - await bot.launch(options.launchOptions); + + if (options.launchOptions !== false) { + await bot.launch(options.launchOptions); + } return bot; }