mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2024-12-25 07:24:39 +03:00
663ebf1a62
* feat(telegraf): update to v4.0.0 * chore(lock): update package-lock * chore(deps): remove telegraf from dependencies * chore(readme): update installation command * chore(deps): add telegraf to dev dependencies
14 lines
364 B
TypeScript
14 lines
364 B
TypeScript
import { Telegraf } from 'telegraf';
|
|
import { TelegrafModuleOptions } from '../interfaces';
|
|
|
|
export async function createBotFactory(
|
|
options: TelegrafModuleOptions,
|
|
): Promise<Telegraf<any>> {
|
|
const bot = new Telegraf<any>(options.token, options.options);
|
|
|
|
bot.use(...(options.middlewares ?? []));
|
|
await bot.launch(options.launchOptions);
|
|
|
|
return bot;
|
|
}
|