mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2025-12-14 01:20:56 +03:00
feat(decorators): TelegrafAction added
This commit is contained in:
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