nestjs-telegraf/lib/decorators/telegraf-entity.decorator.ts

15 lines
392 B
TypeScript
Raw Normal View History

2020-03-19 16:54:34 +03:00
import { SetMetadata } from '@nestjs/common';
import { DECORATORS } from '../telegraf.constants';
export type Entity = string | string[] | RegExp | RegExp[] | Function;
/**
* Entity handling.
* @param entity Entity name
*
* https://telegraf.js.org/#/?id=entity
*/
export function TelegrafEntity(entity: Entity): MethodDecorator {
return SetMetadata(DECORATORS.ENTITY, { entity });
}