2020-03-19 16:39:47 +03:00
|
|
|
import { SetMetadata } from '@nestjs/common';
|
|
|
|
import { DECORATORS } from '../telegraf.constants';
|
|
|
|
|
2020-03-19 18:20:07 +03:00
|
|
|
export type TelegrafCommandCommands = string | string[];
|
|
|
|
|
|
|
|
export interface TelegrafCommandMetadata {
|
|
|
|
commands: TelegrafCommandCommands;
|
|
|
|
}
|
|
|
|
|
2020-03-19 16:39:47 +03:00
|
|
|
/**
|
|
|
|
* Command handling.
|
|
|
|
* @param commands Commands
|
|
|
|
*
|
|
|
|
* https://telegraf.js.org/#/?id=command
|
|
|
|
*/
|
2020-03-19 18:20:07 +03:00
|
|
|
export function TelegrafCommand(
|
|
|
|
commands: TelegrafCommandCommands,
|
|
|
|
): MethodDecorator {
|
2020-03-19 16:39:47 +03:00
|
|
|
return SetMetadata(DECORATORS.COMMAND, { commands });
|
|
|
|
}
|