feat(decorators): metadata typings added

This commit is contained in:
Aleksandr Bukhalo
2020-03-19 18:20:07 +03:00
parent dd59da7737
commit 25710b7908
13 changed files with 162 additions and 34 deletions

View File

@@ -1,12 +1,20 @@
import { SetMetadata } from '@nestjs/common';
import { DECORATORS } from '../telegraf.constants';
export type TelegrafMentionUsername = string | string[];
export interface TelegrafMentionMetadata {
username: TelegrafMentionUsername;
}
/**
* Mention handling.
* @param username Username
*
* https://telegraf.js.org/#/?id=mention
*/
export function TelegrafMention(username: string | string[]): MethodDecorator {
export function TelegrafMention(
username: TelegrafMentionUsername,
): MethodDecorator {
return SetMetadata(DECORATORS.MENTION, { username });
}