mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2025-09-23 09:49:06 +03:00
feat!(): add custom execution context
This commit is contained in:
8
lib/decorators/params/context.decorator.ts
Normal file
8
lib/decorators/params/context.decorator.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { createTelegrafParamDecorator } from '../../utils/param-decorator.util';
|
||||
import { TelegrafParamtype } from '../../enums/telegraf-paramtype.enum';
|
||||
|
||||
export const Context: () => ParameterDecorator = createTelegrafParamDecorator(
|
||||
TelegrafParamtype.CONTEXT,
|
||||
);
|
||||
|
||||
export const Ctx = Context;
|
3
lib/decorators/params/index.ts
Normal file
3
lib/decorators/params/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './context.decorator';
|
||||
export * from './next.decorator';
|
||||
export * from './message-text.decorator';
|
15
lib/decorators/params/message-text.decorator.ts
Normal file
15
lib/decorators/params/message-text.decorator.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { PipeTransform, Type } from '@nestjs/common';
|
||||
import { createPipesTelegrafParamDecorator } from '../../utils/param-decorator.util';
|
||||
import { TelegrafParamtype } from '../../enums/telegraf-paramtype.enum';
|
||||
|
||||
export function MessageText(): ParameterDecorator;
|
||||
export function MessageText(
|
||||
...pipes: (Type<PipeTransform> | PipeTransform)[]
|
||||
): ParameterDecorator;
|
||||
export function MessageText(
|
||||
...pipes: (Type<PipeTransform> | PipeTransform)[]
|
||||
): ParameterDecorator {
|
||||
return createPipesTelegrafParamDecorator(TelegrafParamtype.MESSAGE_TEXT)(
|
||||
...pipes,
|
||||
);
|
||||
}
|
6
lib/decorators/params/next.decorator.ts
Normal file
6
lib/decorators/params/next.decorator.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { createTelegrafParamDecorator } from '../../utils/param-decorator.util';
|
||||
import { TelegrafParamtype } from '../../enums/telegraf-paramtype.enum';
|
||||
|
||||
export const Next: () => ParameterDecorator = createTelegrafParamDecorator(
|
||||
TelegrafParamtype.NEXT,
|
||||
);
|
Reference in New Issue
Block a user