feat(decorators): TelegrafCommand added

This commit is contained in:
Aleksandr Bukhalo
2020-03-19 16:39:47 +03:00
parent 6fddfd26f0
commit c0ffdeff34
5 changed files with 39 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
export * from './telegraf-use.decorator';
export * from './telegraf-on.decorator';
export * from './telegraf-hears.decorator';
export * from './telegraf-command.decorator';
export * from './telegraf-start.decorator';

View File

@@ -0,0 +1,12 @@
import { SetMetadata } from '@nestjs/common';
import { DECORATORS } from '../telegraf.constants';
/**
* Command handling.
* @param commands Commands
*
* https://telegraf.js.org/#/?id=command
*/
export function TelegrafCommand(commands: string | string[]): MethodDecorator {
return SetMetadata(DECORATORS.COMMAND, { commands });
}