mirror of
				https://github.com/Maks1mS/nestjs-telegraf.git
				synced 2025-11-04 07:51:22 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			23 lines
		
	
	
		
			653 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			653 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
import { ArgumentsHost } from '@nestjs/common';
 | 
						|
import { ExecutionContextHost } from '@nestjs/core/helpers/execution-context-host';
 | 
						|
import { TgArgumentsHost } from './tg-arguments-host.interace';
 | 
						|
 | 
						|
export class TelegrafArgumentsHost
 | 
						|
  extends ExecutionContextHost
 | 
						|
  implements TgArgumentsHost {
 | 
						|
  static create(context: ArgumentsHost): TelegrafArgumentsHost {
 | 
						|
    const type = context.getType();
 | 
						|
    const tgContext = new TelegrafArgumentsHost(context.getArgs());
 | 
						|
    tgContext.setType(type);
 | 
						|
    return tgContext;
 | 
						|
  }
 | 
						|
 | 
						|
  getContext<T = any>(): T {
 | 
						|
    return this.getArgByIndex(0);
 | 
						|
  }
 | 
						|
 | 
						|
  getNext<T = any>(): T {
 | 
						|
    return this.getArgByIndex(1);
 | 
						|
  }
 | 
						|
}
 |