initial commit

This commit is contained in:
Alexander Bukhalo
2022-11-20 14:13:48 +03:00
parent 1bb274e8e2
commit 2d23eba148
94 changed files with 65 additions and 17013 deletions

View File

@@ -1,5 +0,0 @@
export * from './update.decorator';
export * from './scene.decorator';
export * from './wizard.decorator';
export * from './inject-bot.decorator';
export * from './inject-all-bots.decorator';

View File

@@ -1,9 +0,0 @@
import { Inject } from '@nestjs/common';
import { Telegraf } from 'telegraf';
import { getAllBotsToken } from '../../utils/get-all-bots-token.util';
export type AllBotsMap = Map<string, Telegraf<any>>;
export const InjectAllBots = (): ParameterDecorator =>
Inject(getAllBotsToken());

View File

@@ -1,5 +0,0 @@
import { Inject } from '@nestjs/common';
import { getBotToken } from '../../utils';
export const InjectBot = (botName?: string): ParameterDecorator =>
Inject(getBotToken(botName));

View File

@@ -1,14 +0,0 @@
import { SetMetadata } from '@nestjs/common';
import { SceneOptions } from 'telegraf/typings/scenes/base';
import { SceneMetadata } from '../../interfaces';
import { SCENE_METADATA } from '../../telegraf.constants';
export const Scene = (
sceneId: string,
options?: SceneOptions<any>,
): ClassDecorator =>
SetMetadata<string, SceneMetadata>(SCENE_METADATA, {
sceneId,
type: 'base',
options,
});

View File

@@ -1,8 +0,0 @@
import { SetMetadata } from '@nestjs/common';
import { UPDATE_METADATA } from '../../telegraf.constants';
/**
* `@Update` decorator, it's like NestJS `@Controller` decorator,
* but for Telegram Bot API updates.
*/
export const Update = (): ClassDecorator => SetMetadata(UPDATE_METADATA, true);

View File

@@ -1,14 +0,0 @@
import { SetMetadata } from '@nestjs/common';
import { SceneOptions } from 'telegraf/typings/scenes/base';
import { SceneMetadata } from '../../interfaces';
import { SCENE_METADATA } from '../../telegraf.constants';
export const Wizard = (
sceneId: string,
options?: SceneOptions<any>,
): ClassDecorator =>
SetMetadata<string, SceneMetadata>(SCENE_METADATA, {
sceneId,
type: 'wizard',
options,
});