mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2024-12-26 07:48:11 +03:00
37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
import { SetMetadata } from '@nestjs/common';
|
|
import { DECORATORS } from '../telegraf.constants';
|
|
import * as tt from 'telegraf/typings/telegram-types';
|
|
|
|
export type TelegrafInlineQueryTriggers = string | string[] | RegExp | RegExp[];
|
|
|
|
export interface InlineQueryOptions {
|
|
triggers?: TelegrafInlineQueryTriggers;
|
|
updateType:
|
|
| tt.UpdateType
|
|
| tt.UpdateType[]
|
|
| tt.MessageSubTypes
|
|
| tt.MessageSubTypes[];
|
|
}
|
|
|
|
/**
|
|
* Registers middleware for handling inline_query actions with regular expressions.
|
|
*
|
|
* @see https://telegraf.js.org/#/?id=inlinequery
|
|
*/
|
|
export const InlineQuery = (
|
|
triggers?: TelegrafInlineQueryTriggers,
|
|
): MethodDecorator => {
|
|
return SetMetadata(DECORATORS.INLINE_QUERY, {
|
|
triggers,
|
|
updateType: 'inline_query',
|
|
});
|
|
};
|
|
|
|
/**
|
|
* 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;
|