mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2025-09-30 12:27:39 +03:00
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;
|
4
lib/decorators/params/index.ts
Normal file
4
lib/decorators/params/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export * from './context.decorator';
|
||||
export * from './next.decorator';
|
||||
export * from './message.decorator';
|
||||
export * from './sender.decorator';
|
21
lib/decorators/params/message.decorator.ts
Normal file
21
lib/decorators/params/message.decorator.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { PipeTransform, Type } from '@nestjs/common';
|
||||
import { createTelegrafPipesParamDecorator } from '../../utils/param-decorator.util';
|
||||
import { TelegrafParamtype } from '../../enums/telegraf-paramtype.enum';
|
||||
|
||||
export function Message(): ParameterDecorator;
|
||||
export function Message(
|
||||
...pipes: (Type<PipeTransform> | PipeTransform)[]
|
||||
): ParameterDecorator;
|
||||
export function Message(
|
||||
property: string,
|
||||
...pipes: (Type<PipeTransform> | PipeTransform)[]
|
||||
): ParameterDecorator;
|
||||
export function Message(
|
||||
property?: string | (Type<PipeTransform> | PipeTransform),
|
||||
...pipes: (Type<PipeTransform> | PipeTransform)[]
|
||||
) {
|
||||
return createTelegrafPipesParamDecorator(TelegrafParamtype.MESSAGE)(
|
||||
property,
|
||||
...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,
|
||||
);
|
21
lib/decorators/params/sender.decorator.ts
Normal file
21
lib/decorators/params/sender.decorator.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { PipeTransform, Type } from '@nestjs/common';
|
||||
import { createTelegrafPipesParamDecorator } from '../../utils/param-decorator.util';
|
||||
import { TelegrafParamtype } from '../../enums/telegraf-paramtype.enum';
|
||||
|
||||
export function Sender(): ParameterDecorator;
|
||||
export function Sender(
|
||||
...pipes: (Type<PipeTransform> | PipeTransform)[]
|
||||
): ParameterDecorator;
|
||||
export function Sender(
|
||||
property: string,
|
||||
...pipes: (Type<PipeTransform> | PipeTransform)[]
|
||||
): ParameterDecorator;
|
||||
export function Sender(
|
||||
property?: string | (Type<PipeTransform> | PipeTransform),
|
||||
...pipes: (Type<PipeTransform> | PipeTransform)[]
|
||||
) {
|
||||
return createTelegrafPipesParamDecorator(TelegrafParamtype.SENDER)(
|
||||
property,
|
||||
...pipes,
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user