feat: add new @Update decorator

This commit is contained in:
Aleksandr Bukhalo 2020-08-14 01:21:33 +03:00
parent 63bac9e760
commit 05d7ae7b12
3 changed files with 10 additions and 0 deletions

View File

@ -14,3 +14,4 @@ export * from './telegraf-cashtag.decorator';
export * from './telegraf-action.decorator';
export * from './telegraf-inline-query.decorator';
export * from './telegraf-game-query.decorator';
export * from './update.decorator';

View File

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

View File

@ -18,4 +18,5 @@ export const DECORATORS = {
ACTION: `${DECORATORS_PREFIX}/ACTION`,
INLINE_QUERY: `${DECORATORS_PREFIX}/INLINE_QUERY`,
GAME_QUERY: `${DECORATORS_PREFIX}/GAME_QUERY`,
UPDATE: `${DECORATORS_PREFIX}/UPDATE`,
};