nestjs-telegraf/lib/decorators/telegraf-hears.decorator.ts
2020-03-19 18:20:07 +03:00

22 lines
555 B
TypeScript

import { SetMetadata } from '@nestjs/common';
import { DECORATORS } from '../telegraf.constants';
import { HearsTriggers } from 'telegraf';
export type TelegrafHearsTriggers = HearsTriggers;
export interface TelegrafHearsMetadata {
triggers: TelegrafHearsTriggers;
}
/**
* Registers middleware for handling text messages.
* @param triggers Triggers
*
* https://telegraf.js.org/#/?id=hears
*/
export function TelegrafHears(
triggers: TelegrafHearsTriggers,
): MethodDecorator {
return SetMetadata(DECORATORS.HEARS, { triggers: triggers });
}