mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2024-12-27 08:18:08 +03:00
24 lines
509 B
TypeScript
24 lines
509 B
TypeScript
import { SetMetadata } from '@nestjs/common';
|
|
import { DECORATORS } from '../telegraf.constants';
|
|
|
|
export type TelegrafEntityEntity =
|
|
| string
|
|
| string[]
|
|
| RegExp
|
|
| RegExp[]
|
|
| Function;
|
|
|
|
export interface TelegrafEntityMetadata {
|
|
entity: TelegrafEntityEntity;
|
|
}
|
|
|
|
/**
|
|
* Entity handling.
|
|
* @param entity Entity name
|
|
*
|
|
* https://telegraf.js.org/#/?id=entity
|
|
*/
|
|
export function TelegrafEntity(entity: TelegrafEntityEntity): MethodDecorator {
|
|
return SetMetadata(DECORATORS.ENTITY, { entity });
|
|
}
|