mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2025-09-30 04:18:51 +03:00
initial commit
This commit is contained in:
@@ -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';
|
@@ -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());
|
@@ -1,5 +0,0 @@
|
||||
import { Inject } from '@nestjs/common';
|
||||
import { getBotToken } from '../../utils';
|
||||
|
||||
export const InjectBot = (botName?: string): ParameterDecorator =>
|
||||
Inject(getBotToken(botName));
|
@@ -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,
|
||||
});
|
@@ -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);
|
@@ -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,
|
||||
});
|
Reference in New Issue
Block a user