2021-01-03 01:30:57 +03:00
|
|
|
import { ArgumentsHost } from '@nestjs/common';
|
|
|
|
import { ExecutionContextHost } from '@nestjs/core/helpers/execution-context-host';
|
2021-09-16 21:37:59 +03:00
|
|
|
import { TgArgumentsHost } from './tg-arguments-host.interface';
|
2021-01-03 01:30:57 +03:00
|
|
|
|
|
|
|
export class TelegrafArgumentsHost
|
|
|
|
extends ExecutionContextHost
|
2022-07-09 12:40:49 +03:00
|
|
|
implements TgArgumentsHost
|
|
|
|
{
|
2021-01-03 01:30:57 +03:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|