mirror of
				https://github.com/Maks1mS/nestjs-telegraf.git
				synced 2025-11-03 23:41:23 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			31 lines
		
	
	
		
			642 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			642 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
import { SetMetadata } from '@nestjs/common';
 | 
						|
import { DECORATORS } from '../telegraf.constants';
 | 
						|
 | 
						|
export type TelegrafEntityEntity =
 | 
						|
  | string
 | 
						|
  | string[]
 | 
						|
  | RegExp
 | 
						|
  | RegExp[]
 | 
						|
  | Function;
 | 
						|
 | 
						|
export interface EntityOptions {
 | 
						|
  entity: TelegrafEntityEntity;
 | 
						|
}
 | 
						|
 | 
						|
/**
 | 
						|
 * Entity handling.
 | 
						|
 *
 | 
						|
 * @see https://telegraf.js.org/#/?id=entity
 | 
						|
 */
 | 
						|
export const Entity = (entity: TelegrafEntityEntity): MethodDecorator => {
 | 
						|
  return SetMetadata(DECORATORS.ENTITY, { entity });
 | 
						|
};
 | 
						|
 | 
						|
/**
 | 
						|
 * Entity handling.
 | 
						|
 *
 | 
						|
 * @see https://telegraf.js.org/#/?id=entity
 | 
						|
 * @deprecated since v2, use Entity decorator instead.
 | 
						|
 */
 | 
						|
export const TelegrafEntity = Entity;
 |