mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2025-09-23 09:49:06 +03:00
feat(decorators): TelegrafAction added
This commit is contained in:
@@ -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';
|
||||
|
13
lib/decorators/telegraf-action.decorator.ts
Normal file
13
lib/decorators/telegraf-action.decorator.ts
Normal 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 });
|
||||
}
|
Reference in New Issue
Block a user