feat(decorators): TelegrafEntity added

This commit is contained in:
Aleksandr Bukhalo
2020-03-19 16:54:34 +03:00
parent 55c6f939a4
commit 8bd20131a1
5 changed files with 42 additions and 0 deletions

View File

@@ -4,3 +4,4 @@ export * from './telegraf-hears.decorator';
export * from './telegraf-command.decorator';
export * from './telegraf-start.decorator';
export * from './telegraf-help.decorator';
export * from './telegraf-entity.decorator';

View File

@@ -0,0 +1,14 @@
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 });
}