0
0
mirror of https://github.com/Maks1mS/nestjs-telegraf.git synced 2025-10-01 20:41:27 +03:00
Files
.devcontainer
.github
.husky
lib
decorators
enums
errors
execution-context
factories
interfaces
services
types
utils
create-bot-factory.util.ts
create-listener-decorator.util.ts
get-all-bots-token.util.ts
get-bot-token.util.ts
index.ts
param-decorator.util.ts
index.ts
stage.provider.ts
telegraf-all-bots.provider.ts
telegraf-core.module.ts
telegraf.constants.ts
telegraf.module.ts
sample
website
.commitlintrc.json
.eslintrc.js
.gitignore
.npmignore
.prettierrc
CHANGELOG.md
LICENSE
README.md
package-lock.json
package.json
tsconfig.json
tsconfig.typedoc.json
nestjs-telegraf/lib/utils/create-bot-factory.util.ts
2022-11-30 14:57:27 +03:00

17 lines
406 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 ?? []));
if (options.launchOptions !== false) {
bot.launch(options.launchOptions);
}
return bot;
}