mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2025-09-23 09:49:06 +03:00
!feat(): add scene support & many refactor
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
export * from './update.decorator';
|
||||
export * from './scene.decorator';
|
||||
export * from './inject-bot.decorator';
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { Inject } from '@nestjs/common';
|
||||
import { TelegrafProvider } from '../../telegraf.provider';
|
||||
import { Telegraf } from 'telegraf';
|
||||
|
||||
export const InjectBot = (): ParameterDecorator => Inject(TelegrafProvider);
|
||||
export const InjectBot = (): ParameterDecorator => Inject(Telegraf);
|
||||
|
8
lib/decorators/core/scene.decorator.ts
Normal file
8
lib/decorators/core/scene.decorator.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { SetMetadata } from '@nestjs/common';
|
||||
import { SCENE_METADATA } from '../../telegraf.constants';
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
export const Scene = (id: string): ClassDecorator =>
|
||||
SetMetadata(SCENE_METADATA, id);
|
@@ -1,2 +1,3 @@
|
||||
export * from './core';
|
||||
export * from './listeners';
|
||||
export * from './scene';
|
||||
|
2
lib/decorators/scene/index.ts
Normal file
2
lib/decorators/scene/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './scene-enter.decorator';
|
||||
export * from './scene-leave.decorator';
|
6
lib/decorators/scene/scene-enter.decorator.ts
Normal file
6
lib/decorators/scene/scene-enter.decorator.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { SetMetadata } from '@nestjs/common';
|
||||
import { SCENE_LISTENER_METADATA } from '../../telegraf.constants';
|
||||
import { SceneEventType } from '../../enums/scene-event-type.enum';
|
||||
|
||||
export const SceneEnter = (): MethodDecorator =>
|
||||
SetMetadata(SCENE_LISTENER_METADATA, SceneEventType.Enter);
|
6
lib/decorators/scene/scene-leave.decorator.ts
Normal file
6
lib/decorators/scene/scene-leave.decorator.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { SetMetadata } from '@nestjs/common';
|
||||
import { SCENE_LISTENER_METADATA } from '../../telegraf.constants';
|
||||
import { SceneEventType } from '../../enums/scene-event-type.enum';
|
||||
|
||||
export const SceneLeave = (): MethodDecorator =>
|
||||
SetMetadata(SCENE_LISTENER_METADATA, SceneEventType.Leave);
|
Reference in New Issue
Block a user