mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2024-12-25 23:44:39 +03:00
23 lines
622 B
TypeScript
23 lines
622 B
TypeScript
import { SetMetadata } from '@nestjs/common';
|
|
import { DECORATORS } from '../telegraf.constants';
|
|
import { HearsTriggers } from 'telegraf/typings/composer';
|
|
import { Context } from '../interfaces';
|
|
|
|
export type TelegrafHearsTriggers = HearsTriggers<Context>;
|
|
|
|
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 });
|
|
}
|