mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2024-12-25 07:24:39 +03:00
21 lines
490 B
TypeScript
21 lines
490 B
TypeScript
import { SetMetadata } from '@nestjs/common';
|
|
import { DECORATORS } from '../telegraf.constants';
|
|
|
|
export type TelegrafCommandCommands = string | string[];
|
|
|
|
export interface TelegrafCommandMetadata {
|
|
commands: TelegrafCommandCommands;
|
|
}
|
|
|
|
/**
|
|
* Command handling.
|
|
* @param commands Commands
|
|
*
|
|
* https://telegraf.js.org/#/?id=command
|
|
*/
|
|
export function TelegrafCommand(
|
|
commands: TelegrafCommandCommands,
|
|
): MethodDecorator {
|
|
return SetMetadata(DECORATORS.COMMAND, { commands });
|
|
}
|