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