feat(scene): added wizard scene support

This commit is contained in:
xTCry [Vladislav Kh]
2021-08-03 17:03:16 +03:00
parent a4cb8df434
commit 623ce16327
10 changed files with 127 additions and 12 deletions

View File

@@ -1,3 +1,4 @@
export * from './update.decorator';
export * from './scene.decorator';
export * from './wizard.decorator';
export * from './inject-bot.decorator';

View File

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

View File

@@ -0,0 +1,14 @@
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,
});