2020-03-19 17:25:47 +03:00
|
|
|
import { SetMetadata } from '@nestjs/common';
|
|
|
|
import { DECORATORS } from '../telegraf.constants';
|
|
|
|
|
2020-03-19 18:20:07 +03:00
|
|
|
export type TelegrafInlineQueryTriggers = string | string[] | RegExp | RegExp[];
|
|
|
|
|
|
|
|
export interface TelegrafInlineQueryMetadata {
|
|
|
|
triggers: TelegrafInlineQueryTriggers;
|
|
|
|
}
|
2020-03-19 17:25:47 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Registers middleware for handling inline_query actions with regular expressions.
|
|
|
|
* @param triggers Triggers
|
|
|
|
*
|
|
|
|
* https://telegraf.js.org/#/?id=inlinequery
|
|
|
|
*/
|
2020-03-19 18:20:07 +03:00
|
|
|
export function TelegrafInlineQuery(
|
|
|
|
triggers: TelegrafInlineQueryTriggers,
|
|
|
|
): MethodDecorator {
|
2020-03-19 17:25:47 +03:00
|
|
|
return SetMetadata(DECORATORS.INLINE_QUERY, { triggers });
|
|
|
|
}
|