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[];
|
|
|
|
|
2020-08-14 12:42:57 +03:00
|
|
|
export interface InlineQueryOptions {
|
2020-03-19 18:20:07 +03:00
|
|
|
triggers: TelegrafInlineQueryTriggers;
|
|
|
|
}
|
2020-03-19 17:25:47 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Registers middleware for handling inline_query actions with regular expressions.
|
|
|
|
*
|
2020-08-14 12:42:57 +03:00
|
|
|
* @see https://telegraf.js.org/#/?id=inlinequery
|
2020-03-19 17:25:47 +03:00
|
|
|
*/
|
2020-08-14 12:42:57 +03:00
|
|
|
export const InlineQuery = (
|
2020-03-19 18:20:07 +03:00
|
|
|
triggers: TelegrafInlineQueryTriggers,
|
2020-08-14 12:42:57 +03:00
|
|
|
): MethodDecorator => {
|
2020-03-19 17:25:47 +03:00
|
|
|
return SetMetadata(DECORATORS.INLINE_QUERY, { triggers });
|
2020-08-14 12:42:57 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Registers middleware for handling inline_query actions with regular expressions.
|
|
|
|
*
|
|
|
|
* @see https://telegraf.js.org/#/?id=inlinequery
|
|
|
|
* @deprecated since v2, use InlineQuery decorator instead.
|
|
|
|
*/
|
|
|
|
export const TelegrafInlineQuery = InlineQuery;
|