nestjs-telegraf/lib/decorators/telegraf-on.decorator.ts
2020-03-19 16:21:35 +03:00

16 lines
507 B
TypeScript

import { SetMetadata } from '@nestjs/common';
import { DECORATORS } from '../telegraf.constants';
import { UpdateType, MessageSubTypes } from 'telegraf/typings/telegram-types';
/**
* Registers middleware for provided update type.
* @param updateTypes Update type
*
* https://telegraf.js.org/#/?id=on
*/
export function TelegrafOn(
updateTypes: UpdateType | UpdateType[] | MessageSubTypes | MessageSubTypes[],
): MethodDecorator {
return SetMetadata(DECORATORS.ON, { updateTypes: updateTypes });
}