mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2024-12-26 15:58:09 +03:00
14 lines
368 B
TypeScript
14 lines
368 B
TypeScript
|
import { Telegraf } from 'telegraf';
|
||
|
import { TelegrafModuleOptions } from '../interfaces';
|
||
|
|
||
|
export async function createBotFactory(
|
||
|
options: TelegrafModuleOptions,
|
||
|
): Promise<Telegraf<never>> {
|
||
|
const bot = new Telegraf<never>(options.token, options.options);
|
||
|
|
||
|
bot.use(...(options.middlewares ?? []));
|
||
|
await bot.launch(options.launchOptions);
|
||
|
|
||
|
return bot;
|
||
|
}
|