feat(decorators): TelegrafAction added

This commit is contained in:
Aleksandr Bukhalo
2020-03-19 17:20:13 +03:00
parent 7d3e266f0f
commit 511f9ebd77
5 changed files with 41 additions and 0 deletions

View File

@@ -10,3 +10,4 @@ export * from './telegraf-mention.decorator';
export * from './telegraf-phone.decorator';
export * from './telegraf-hashtag.decorator';
export * from './telegraf-cashtag.decorator';
export * from './telegraf-action.decorator';

View File

@@ -0,0 +1,13 @@
import { SetMetadata } from '@nestjs/common';
import { DECORATORS } from '../telegraf.constants';
import { HearsTriggers } from 'telegraf';
/**
* Registers middleware for handling callback_data actions with regular expressions.
* @param triggers Triggers
*
* https://telegraf.js.org/#/?id=action
*/
export function TelegrafAction(triggers: HearsTriggers): MethodDecorator {
return SetMetadata(DECORATORS.ACTION, { triggers });
}