diff --git a/lib/decorators/index.ts b/lib/decorators/index.ts index 37dcea4..76f6f1a 100644 --- a/lib/decorators/index.ts +++ b/lib/decorators/index.ts @@ -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'; diff --git a/lib/decorators/update.decorator.ts b/lib/decorators/update.decorator.ts new file mode 100644 index 0000000..985bb8e --- /dev/null +++ b/lib/decorators/update.decorator.ts @@ -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, {}); diff --git a/lib/telegraf.constants.ts b/lib/telegraf.constants.ts index 59f27a2..b21ebd4 100644 --- a/lib/telegraf.constants.ts +++ b/lib/telegraf.constants.ts @@ -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`, };