mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2025-09-23 09:49:06 +03:00
feat(scene): added wizard scene support
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
export * from './update.decorator';
|
||||
export * from './scene.decorator';
|
||||
export * from './wizard.decorator';
|
||||
export * from './inject-bot.decorator';
|
||||
|
@@ -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,
|
||||
});
|
||||
|
14
lib/decorators/core/wizard.decorator.ts
Normal file
14
lib/decorators/core/wizard.decorator.ts
Normal 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,
|
||||
});
|
@@ -1,2 +1,3 @@
|
||||
export * from './scene-enter.decorator';
|
||||
export * from './scene-leave.decorator';
|
||||
export * from './wizard-step.decorator';
|
||||
|
6
lib/decorators/scene/wizard-step.decorator.ts
Normal file
6
lib/decorators/scene/wizard-step.decorator.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { SetMetadata } from '@nestjs/common';
|
||||
import { WizardStepMetadata } from '../../interfaces';
|
||||
import { WIZARD_STEP_METADATA } from '../../telegraf.constants';
|
||||
|
||||
export const WizardStep = (step: number) =>
|
||||
SetMetadata<string, WizardStepMetadata>(WIZARD_STEP_METADATA, { step });
|
Reference in New Issue
Block a user