mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2025-09-23 09:49:06 +03:00
feat(decorators): TelegrafEntity added
This commit is contained in:
@@ -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';
|
||||
|
14
lib/decorators/telegraf-entity.decorator.ts
Normal file
14
lib/decorators/telegraf-entity.decorator.ts
Normal 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 });
|
||||
}
|
Reference in New Issue
Block a user