mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2025-09-23 09:49:06 +03:00
merge refactor/v2
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Inject } from '@nestjs/common';
|
||||
import { Telegraf } from 'telegraf';
|
||||
import { getBotToken } from '../../utils';
|
||||
|
||||
export const InjectBot = (): ParameterDecorator => Inject(Telegraf);
|
||||
export const InjectBot = (name?: string): ParameterDecorator =>
|
||||
Inject(getBotToken(name));
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { createUpdateListenerDecorator } from '../../utils';
|
||||
import { createListenerDecorator } from '../../utils';
|
||||
|
||||
/**
|
||||
* Registers middleware for handling callback_data actions with regular expressions.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=action
|
||||
*/
|
||||
export const Action = createUpdateListenerDecorator('action');
|
||||
export const Action = createListenerDecorator('action');
|
||||
|
@@ -1,8 +1,10 @@
|
||||
import { createUpdateListenerDecorator } from '../../utils';
|
||||
import { createMissedListenerDecorator } from '../../utils';
|
||||
|
||||
/**
|
||||
* Cashtag handling.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=cashtag
|
||||
*/
|
||||
export const Cashtag = createUpdateListenerDecorator('cashtag');
|
||||
export const Cashtag = createMissedListenerDecorator<[string | string[]]>(
|
||||
'cashtag',
|
||||
);
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { createUpdateListenerDecorator } from '../../utils';
|
||||
import { createListenerDecorator } from '../../utils';
|
||||
|
||||
/**
|
||||
* Command handling.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=command
|
||||
*/
|
||||
export const Command = createUpdateListenerDecorator('command');
|
||||
export const Command = createListenerDecorator('command');
|
||||
|
@@ -1,8 +1,10 @@
|
||||
import { createUpdateListenerDecorator } from '../../utils';
|
||||
import { createMissedListenerDecorator } from '../../utils';
|
||||
|
||||
/**
|
||||
* Registers middleware for handling messages with email entity.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=telegraf-email
|
||||
*/
|
||||
export const Email = createUpdateListenerDecorator('email');
|
||||
export const Email = createMissedListenerDecorator<[string | string[]]>(
|
||||
'email',
|
||||
);
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { createUpdateListenerDecorator } from '../../utils';
|
||||
import { createListenerDecorator } from '../../utils';
|
||||
|
||||
/**
|
||||
* Registers middleware for handling callback_data actions with game query.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=inlinequery
|
||||
*/
|
||||
export const GameQuery = createUpdateListenerDecorator('gameQuery');
|
||||
export const GameQuery = createListenerDecorator('gameQuery');
|
||||
|
@@ -1,8 +1,10 @@
|
||||
import { createUpdateListenerDecorator } from '../../utils';
|
||||
import { createMissedListenerDecorator } from '../../utils';
|
||||
|
||||
/**
|
||||
* Hashtag handling.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=hashtag
|
||||
*/
|
||||
export const Hashtag = createUpdateListenerDecorator('hashtag');
|
||||
export const Hashtag = createMissedListenerDecorator<[string | string[]]>(
|
||||
'hashtag',
|
||||
);
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { createUpdateListenerDecorator } from '../../utils';
|
||||
import { createListenerDecorator } from '../../utils';
|
||||
|
||||
/**
|
||||
* Registers middleware for handling text messages.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=hears
|
||||
*/
|
||||
export const Hears = createUpdateListenerDecorator('hears');
|
||||
export const Hears = createListenerDecorator('hears');
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { createUpdateListenerDecorator } from '../../utils';
|
||||
import { createListenerDecorator } from '../../utils';
|
||||
|
||||
/**
|
||||
* Handler for /help command.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=help
|
||||
*/
|
||||
export const Help = createUpdateListenerDecorator('help');
|
||||
export const Help = createListenerDecorator('help');
|
||||
|
@@ -1,8 +1,11 @@
|
||||
import { createUpdateListenerDecorator } from '../../utils';
|
||||
import { createMissedListenerDecorator } from '../../utils';
|
||||
import { HearsTriggers } from 'telegraf/typings/composer';
|
||||
|
||||
/**
|
||||
* Registers middleware for handling inline_query actions with regular expressions.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=inlinequery
|
||||
*/
|
||||
export const InlineQuery = createUpdateListenerDecorator('inlineQuery');
|
||||
export const InlineQuery = createMissedListenerDecorator<
|
||||
[HearsTriggers<unknown>]
|
||||
>('inlineQuery');
|
||||
|
@@ -1,8 +1,10 @@
|
||||
import { createUpdateListenerDecorator } from '../../utils';
|
||||
import { createMissedListenerDecorator } from '../../utils';
|
||||
|
||||
/**
|
||||
* Mention handling.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=mention
|
||||
*/
|
||||
export const Mention = createUpdateListenerDecorator('mention');
|
||||
export const Mention = createMissedListenerDecorator<[string | string[]]>(
|
||||
'mention',
|
||||
);
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { createUpdateListenerDecorator } from '../../utils';
|
||||
import { createListenerDecorator } from '../../utils';
|
||||
|
||||
/**
|
||||
* Registers middleware for provided update type.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=on
|
||||
*/
|
||||
export const On = createUpdateListenerDecorator('on');
|
||||
export const On = createListenerDecorator('on');
|
||||
|
@@ -1,8 +1,10 @@
|
||||
import { createUpdateListenerDecorator } from '../../utils';
|
||||
import { createMissedListenerDecorator } from '../../utils';
|
||||
|
||||
/**
|
||||
* Phone number handling.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=phone
|
||||
*/
|
||||
export const Phone = createUpdateListenerDecorator('phone');
|
||||
export const Phone = createMissedListenerDecorator<[string | string[]]>(
|
||||
'phone',
|
||||
);
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { createUpdateListenerDecorator } from '../../utils';
|
||||
import { createMissedListenerDecorator } from '../../utils';
|
||||
|
||||
/**
|
||||
* Handler for /settings command.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=settings
|
||||
*/
|
||||
export const Settings = createUpdateListenerDecorator('settings');
|
||||
export const Settings = createMissedListenerDecorator<[]>('settings');
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { createUpdateListenerDecorator } from '../../utils';
|
||||
import { createListenerDecorator } from '../../utils';
|
||||
|
||||
/**
|
||||
* Handler for /start command.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=start
|
||||
*/
|
||||
export const Start = createUpdateListenerDecorator('start');
|
||||
export const Start = createListenerDecorator('start');
|
||||
|
@@ -1,8 +1,10 @@
|
||||
import { createUpdateListenerDecorator } from '../../utils';
|
||||
import { createMissedListenerDecorator } from '../../utils';
|
||||
|
||||
/**
|
||||
* Registers middleware for handling messages with text_link entity.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=telegraf-textlink
|
||||
*/
|
||||
export const TextLink = createUpdateListenerDecorator('textLink');
|
||||
export const TextLink = createMissedListenerDecorator<[string | string[]]>(
|
||||
'textLink',
|
||||
);
|
||||
|
@@ -1,8 +1,10 @@
|
||||
import { createUpdateListenerDecorator } from '../../utils';
|
||||
import { createMissedListenerDecorator } from '../../utils';
|
||||
|
||||
/**
|
||||
* Registers middleware for handling messages with text_mention entity.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=telegraf-textlink
|
||||
*/
|
||||
export const TextMention = createUpdateListenerDecorator('textMention');
|
||||
export const TextMention = createMissedListenerDecorator<[string | string[]]>(
|
||||
'textMention',
|
||||
);
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { createUpdateListenerDecorator } from '../../utils';
|
||||
import { createMissedListenerDecorator } from '../../utils';
|
||||
|
||||
/**
|
||||
* Registers middleware for handling messages with url entity.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=telegraf-url
|
||||
*/
|
||||
export const Url = createUpdateListenerDecorator('url');
|
||||
export const Url = createMissedListenerDecorator<[string | string[]]>('url');
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { createUpdateListenerDecorator } from '../../utils';
|
||||
import { createListenerDecorator } from '../../utils';
|
||||
|
||||
/**
|
||||
* Registers a middleware.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=use
|
||||
*/
|
||||
export const Use = createUpdateListenerDecorator('use');
|
||||
export const Use = createListenerDecorator('use');
|
||||
|
@@ -1,3 +1,3 @@
|
||||
import { createSceneListenerDecorator } from '../../utils';
|
||||
import { createListenerDecorator } from '../../utils';
|
||||
|
||||
export const SceneEnter = createSceneListenerDecorator('enter');
|
||||
export const SceneEnter = createListenerDecorator('enter');
|
||||
|
@@ -1,3 +1,3 @@
|
||||
import { createSceneListenerDecorator } from '../../utils';
|
||||
import { createListenerDecorator } from '../../utils';
|
||||
|
||||
export const SceneLeave = createSceneListenerDecorator('leave');
|
||||
export const SceneLeave = createListenerDecorator('leave');
|
||||
|
Reference in New Issue
Block a user