@mtcute/dispatcher 0.29.6 → 0.29.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/context/bot-guest-chat-query.cjs +20 -0
- package/context/bot-guest-chat-query.d.cts +15 -0
- package/context/bot-guest-chat-query.d.ts +15 -0
- package/context/bot-guest-chat-query.js +15 -0
- package/context/index.d.cts +1 -0
- package/context/index.d.ts +1 -0
- package/context/parse.cjs +3 -0
- package/context/parse.d.cts +2 -1
- package/context/parse.d.ts +2 -1
- package/context/parse.js +3 -0
- package/dispatcher.cjs +4 -0
- package/dispatcher.d.cts +17 -2
- package/dispatcher.d.ts +17 -2
- package/dispatcher.js +4 -0
- package/handler.d.cts +3 -2
- package/handler.d.ts +3 -2
- package/index.cjs +2 -0
- package/index.js +2 -0
- package/package.json +2 -2
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
|
+
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
+
console.warn("[@mtcute/dispatcher] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
|
+
console.warn("[@mtcute/dispatcher] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
|
+
}
|
|
6
|
+
"use strict";
|
|
7
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
|
+
const core = require("@mtcute/core");
|
|
9
|
+
class BotGuestChatQueryContext extends core.BotGuestChatQuery {
|
|
10
|
+
constructor(client, query) {
|
|
11
|
+
super(query.raw, query._peers);
|
|
12
|
+
this.client = client;
|
|
13
|
+
}
|
|
14
|
+
_name = "bot_guest_chat_query";
|
|
15
|
+
/** Answer this query with a single result */
|
|
16
|
+
answer(...params) {
|
|
17
|
+
return this.client.answerBotGuestChatQuery(this.id, ...params);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.BotGuestChatQueryContext = BotGuestChatQueryContext;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ParametersSkip1, BotGuestChatQuery } from '@mtcute/core';
|
|
2
|
+
import { TelegramClient } from '@mtcute/core/client.js';
|
|
3
|
+
import { UpdateContext } from './base.js';
|
|
4
|
+
/**
|
|
5
|
+
* Context of a bot guest chat query update.
|
|
6
|
+
*
|
|
7
|
+
* This is a subclass of {@link BotGuestChatQuery}, so all its fields are also available.
|
|
8
|
+
*/
|
|
9
|
+
export declare class BotGuestChatQueryContext extends BotGuestChatQuery implements UpdateContext<BotGuestChatQuery> {
|
|
10
|
+
readonly client: TelegramClient;
|
|
11
|
+
readonly _name: "bot_guest_chat_query";
|
|
12
|
+
constructor(client: TelegramClient, query: BotGuestChatQuery);
|
|
13
|
+
/** Answer this query with a single result */
|
|
14
|
+
answer(...params: ParametersSkip1<TelegramClient['answerBotGuestChatQuery']>): ReturnType<TelegramClient['answerBotGuestChatQuery']>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ParametersSkip1, BotGuestChatQuery } from '@mtcute/core';
|
|
2
|
+
import { TelegramClient } from '@mtcute/core/client.js';
|
|
3
|
+
import { UpdateContext } from './base.js';
|
|
4
|
+
/**
|
|
5
|
+
* Context of a bot guest chat query update.
|
|
6
|
+
*
|
|
7
|
+
* This is a subclass of {@link BotGuestChatQuery}, so all its fields are also available.
|
|
8
|
+
*/
|
|
9
|
+
export declare class BotGuestChatQueryContext extends BotGuestChatQuery implements UpdateContext<BotGuestChatQuery> {
|
|
10
|
+
readonly client: TelegramClient;
|
|
11
|
+
readonly _name: "bot_guest_chat_query";
|
|
12
|
+
constructor(client: TelegramClient, query: BotGuestChatQuery);
|
|
13
|
+
/** Answer this query with a single result */
|
|
14
|
+
answer(...params: ParametersSkip1<TelegramClient['answerBotGuestChatQuery']>): ReturnType<TelegramClient['answerBotGuestChatQuery']>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BotGuestChatQuery } from "@mtcute/core";
|
|
2
|
+
class BotGuestChatQueryContext extends BotGuestChatQuery {
|
|
3
|
+
constructor(client, query) {
|
|
4
|
+
super(query.raw, query._peers);
|
|
5
|
+
this.client = client;
|
|
6
|
+
}
|
|
7
|
+
_name = "bot_guest_chat_query";
|
|
8
|
+
/** Answer this query with a single result */
|
|
9
|
+
answer(...params) {
|
|
10
|
+
return this.client.answerBotGuestChatQuery(this.id, ...params);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
BotGuestChatQueryContext
|
|
15
|
+
};
|
package/context/index.d.cts
CHANGED
package/context/index.d.ts
CHANGED
package/context/parse.cjs
CHANGED
|
@@ -5,6 +5,7 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
|
|
|
5
5
|
}
|
|
6
6
|
"use strict";
|
|
7
7
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
|
+
const botGuestChatQuery = require("./bot-guest-chat-query.cjs");
|
|
8
9
|
const businessMessage = require("./business-message.cjs");
|
|
9
10
|
const callbackQuery = require("./callback-query.cjs");
|
|
10
11
|
const chatJoinRequest = require("./chat-join-request.cjs");
|
|
@@ -20,6 +21,8 @@ function _parsedUpdateToContext(client, update) {
|
|
|
20
21
|
return new message.MessageContext(client, update.data);
|
|
21
22
|
case "inline_query":
|
|
22
23
|
return new inlineQuery.InlineQueryContext(client, update.data);
|
|
24
|
+
case "bot_guest_chat_query":
|
|
25
|
+
return new botGuestChatQuery.BotGuestChatQueryContext(client, update.data);
|
|
23
26
|
case "chosen_inline_result":
|
|
24
27
|
return new chosenInlineResult.ChosenInlineResultContext(client, update.data);
|
|
25
28
|
case "callback_query":
|
package/context/parse.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BotReactionCountUpdate, BotReactionUpdate, BotStoppedUpdate, BusinessConnection, ChatJoinRequestUpdate, ChatMemberUpdate, DeleteBusinessMessageUpdate, DeleteMessageUpdate, DeleteStoryUpdate, HistoryReadUpdate, ParsedUpdate, PollUpdate, PollVoteUpdate, StoryUpdate, UserStatusUpdate, UserTypingUpdate } from '@mtcute/core';
|
|
2
2
|
import { TelegramClient } from '@mtcute/core/client.js';
|
|
3
3
|
import { UpdateContextDistributed } from './base.js';
|
|
4
|
+
import { BotGuestChatQueryContext } from './bot-guest-chat-query.js';
|
|
4
5
|
import { BusinessMessageContext } from './business-message.js';
|
|
5
6
|
import { BusinessCallbackQueryContext, CallbackQueryContext, InlineCallbackQueryContext } from './callback-query.js';
|
|
6
7
|
import { ChatJoinRequestUpdateContext } from './chat-join-request.js';
|
|
@@ -8,6 +9,6 @@ import { ChosenInlineResultContext } from './chosen-inline-result.js';
|
|
|
8
9
|
import { InlineQueryContext } from './inline-query.js';
|
|
9
10
|
import { MessageContext } from './message.js';
|
|
10
11
|
import { PreCheckoutQueryContext } from './pre-checkout-query.js';
|
|
11
|
-
export type UpdateContextType = MessageContext | InlineQueryContext | ChosenInlineResultContext | CallbackQueryContext | InlineCallbackQueryContext | BusinessCallbackQueryContext | ChatJoinRequestUpdateContext | PreCheckoutQueryContext | BusinessMessageContext | UpdateContextDistributed<DeleteMessageUpdate | ChatMemberUpdate | PollUpdate | PollVoteUpdate | UserStatusUpdate | UserTypingUpdate | HistoryReadUpdate | BotStoppedUpdate | ChatJoinRequestUpdate | StoryUpdate | DeleteStoryUpdate | BotReactionUpdate | BotReactionCountUpdate | BusinessConnection | DeleteBusinessMessageUpdate>;
|
|
12
|
+
export type UpdateContextType = MessageContext | InlineQueryContext | BotGuestChatQueryContext | ChosenInlineResultContext | CallbackQueryContext | InlineCallbackQueryContext | BusinessCallbackQueryContext | ChatJoinRequestUpdateContext | PreCheckoutQueryContext | BusinessMessageContext | UpdateContextDistributed<DeleteMessageUpdate | ChatMemberUpdate | PollUpdate | PollVoteUpdate | UserStatusUpdate | UserTypingUpdate | HistoryReadUpdate | BotStoppedUpdate | ChatJoinRequestUpdate | StoryUpdate | DeleteStoryUpdate | BotReactionUpdate | BotReactionCountUpdate | BusinessConnection | DeleteBusinessMessageUpdate>;
|
|
12
13
|
/** @internal */
|
|
13
14
|
export declare function _parsedUpdateToContext(client: TelegramClient, update: ParsedUpdate): UpdateContextType;
|
package/context/parse.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BotReactionCountUpdate, BotReactionUpdate, BotStoppedUpdate, BusinessConnection, ChatJoinRequestUpdate, ChatMemberUpdate, DeleteBusinessMessageUpdate, DeleteMessageUpdate, DeleteStoryUpdate, HistoryReadUpdate, ParsedUpdate, PollUpdate, PollVoteUpdate, StoryUpdate, UserStatusUpdate, UserTypingUpdate } from '@mtcute/core';
|
|
2
2
|
import { TelegramClient } from '@mtcute/core/client.js';
|
|
3
3
|
import { UpdateContextDistributed } from './base.js';
|
|
4
|
+
import { BotGuestChatQueryContext } from './bot-guest-chat-query.js';
|
|
4
5
|
import { BusinessMessageContext } from './business-message.js';
|
|
5
6
|
import { BusinessCallbackQueryContext, CallbackQueryContext, InlineCallbackQueryContext } from './callback-query.js';
|
|
6
7
|
import { ChatJoinRequestUpdateContext } from './chat-join-request.js';
|
|
@@ -8,6 +9,6 @@ import { ChosenInlineResultContext } from './chosen-inline-result.js';
|
|
|
8
9
|
import { InlineQueryContext } from './inline-query.js';
|
|
9
10
|
import { MessageContext } from './message.js';
|
|
10
11
|
import { PreCheckoutQueryContext } from './pre-checkout-query.js';
|
|
11
|
-
export type UpdateContextType = MessageContext | InlineQueryContext | ChosenInlineResultContext | CallbackQueryContext | InlineCallbackQueryContext | BusinessCallbackQueryContext | ChatJoinRequestUpdateContext | PreCheckoutQueryContext | BusinessMessageContext | UpdateContextDistributed<DeleteMessageUpdate | ChatMemberUpdate | PollUpdate | PollVoteUpdate | UserStatusUpdate | UserTypingUpdate | HistoryReadUpdate | BotStoppedUpdate | ChatJoinRequestUpdate | StoryUpdate | DeleteStoryUpdate | BotReactionUpdate | BotReactionCountUpdate | BusinessConnection | DeleteBusinessMessageUpdate>;
|
|
12
|
+
export type UpdateContextType = MessageContext | InlineQueryContext | BotGuestChatQueryContext | ChosenInlineResultContext | CallbackQueryContext | InlineCallbackQueryContext | BusinessCallbackQueryContext | ChatJoinRequestUpdateContext | PreCheckoutQueryContext | BusinessMessageContext | UpdateContextDistributed<DeleteMessageUpdate | ChatMemberUpdate | PollUpdate | PollVoteUpdate | UserStatusUpdate | UserTypingUpdate | HistoryReadUpdate | BotStoppedUpdate | ChatJoinRequestUpdate | StoryUpdate | DeleteStoryUpdate | BotReactionUpdate | BotReactionCountUpdate | BusinessConnection | DeleteBusinessMessageUpdate>;
|
|
12
13
|
/** @internal */
|
|
13
14
|
export declare function _parsedUpdateToContext(client: TelegramClient, update: ParsedUpdate): UpdateContextType;
|
package/context/parse.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BotGuestChatQueryContext } from "./bot-guest-chat-query.js";
|
|
1
2
|
import { BusinessMessageContext } from "./business-message.js";
|
|
2
3
|
import { BusinessCallbackQueryContext, InlineCallbackQueryContext, CallbackQueryContext } from "./callback-query.js";
|
|
3
4
|
import { ChatJoinRequestUpdateContext } from "./chat-join-request.js";
|
|
@@ -13,6 +14,8 @@ function _parsedUpdateToContext(client, update) {
|
|
|
13
14
|
return new MessageContext(client, update.data);
|
|
14
15
|
case "inline_query":
|
|
15
16
|
return new InlineQueryContext(client, update.data);
|
|
17
|
+
case "bot_guest_chat_query":
|
|
18
|
+
return new BotGuestChatQueryContext(client, update.data);
|
|
16
19
|
case "chosen_inline_result":
|
|
17
20
|
return new ChosenInlineResultContext(client, update.data);
|
|
18
21
|
case "callback_query":
|
package/dispatcher.cjs
CHANGED
|
@@ -784,6 +784,10 @@ class Dispatcher {
|
|
|
784
784
|
this._addKnownHandler("inline_query", filter, handler, group);
|
|
785
785
|
}
|
|
786
786
|
/** @internal */
|
|
787
|
+
onBotGuestChatQuery(filter, handler, group) {
|
|
788
|
+
this._addKnownHandler("bot_guest_chat_query", filter, handler, group);
|
|
789
|
+
}
|
|
790
|
+
/** @internal */
|
|
787
791
|
onChosenInlineResult(filter, handler, group) {
|
|
788
792
|
this._addKnownHandler("chosen_inline_result", filter, handler, group);
|
|
789
793
|
}
|
package/dispatcher.d.cts
CHANGED
|
@@ -2,9 +2,9 @@ import { BotReactionCountUpdate, BotReactionUpdate, BotStoppedUpdate, BusinessCo
|
|
|
2
2
|
import { TelegramClient } from '@mtcute/core/client.js';
|
|
3
3
|
import { UpdateContext } from './context/base.js';
|
|
4
4
|
import { BusinessMessageContext } from './context/business-message.js';
|
|
5
|
-
import { BusinessCallbackQueryContext, CallbackQueryContext, ChatJoinRequestUpdateContext, ChosenInlineResultContext, InlineCallbackQueryContext, InlineQueryContext, MessageContext, PreCheckoutQueryContext } from './context/index.js';
|
|
5
|
+
import { BotGuestChatQueryContext, BusinessCallbackQueryContext, CallbackQueryContext, ChatJoinRequestUpdateContext, ChosenInlineResultContext, InlineCallbackQueryContext, InlineQueryContext, MessageContext, PreCheckoutQueryContext } from './context/index.js';
|
|
6
6
|
import { filters, UpdateFilter } from './filters/index.js';
|
|
7
|
-
import { BotChatJoinRequestHandler, BotReactionCountUpdateHandler, BotReactionUpdateHandler, BotStoppedHandler, BusinessCallbackQueryHandler, BusinessConnectionUpdateHandler, BusinessMessageGroupHandler, CallbackQueryHandler, ChatJoinRequestHandler, ChatMemberUpdateHandler, ChosenInlineResultHandler, DeleteBusinessMessageHandler, DeleteMessageHandler, DeleteStoryHandler, EditBusinessMessageHandler, EditMessageHandler, HistoryReadHandler, InlineCallbackQueryHandler, InlineQueryHandler, MessageGroupHandler, NewBusinessMessageHandler, NewMessageHandler, PollUpdateHandler, PollVoteHandler, PreCheckoutQueryHandler, RawUpdateHandler, StoryUpdateHandler, UpdateHandler, UserStatusUpdateHandler, UserTypingHandler } from './handler.js';
|
|
7
|
+
import { BotChatJoinRequestHandler, BotGuestChatQueryHandler, BotReactionCountUpdateHandler, BotReactionUpdateHandler, BotStoppedHandler, BusinessCallbackQueryHandler, BusinessConnectionUpdateHandler, BusinessMessageGroupHandler, CallbackQueryHandler, ChatJoinRequestHandler, ChatMemberUpdateHandler, ChosenInlineResultHandler, DeleteBusinessMessageHandler, DeleteMessageHandler, DeleteStoryHandler, EditBusinessMessageHandler, EditMessageHandler, HistoryReadHandler, InlineCallbackQueryHandler, InlineQueryHandler, MessageGroupHandler, NewBusinessMessageHandler, NewMessageHandler, PollUpdateHandler, PollVoteHandler, PreCheckoutQueryHandler, RawUpdateHandler, StoryUpdateHandler, UpdateHandler, UserStatusUpdateHandler, UserTypingHandler } from './handler.js';
|
|
8
8
|
import { PropagationAction } from './propagation.js';
|
|
9
9
|
import { IStateStorageProvider, StateKeyDelegate, UpdateState } from './state/index.js';
|
|
10
10
|
import { SceneTransitionContext } from './context/scene-transition.js';
|
|
@@ -499,6 +499,21 @@ export declare class Dispatcher<State extends object = never> {
|
|
|
499
499
|
* @param group Handler group index
|
|
500
500
|
*/
|
|
501
501
|
onInlineQuery<Mod>(filter: UpdateFilter<InlineQueryContext, Mod>, handler: InlineQueryHandler<filters.Modify<InlineQueryContext, Mod>>['callback'], group?: number): void;
|
|
502
|
+
/**
|
|
503
|
+
* Register a bot guest chat query handler without any filters
|
|
504
|
+
*
|
|
505
|
+
* @param handler Bot guest chat query handler
|
|
506
|
+
* @param group Handler group index
|
|
507
|
+
*/
|
|
508
|
+
onBotGuestChatQuery(handler: BotGuestChatQueryHandler['callback'], group?: number): void;
|
|
509
|
+
/**
|
|
510
|
+
* Register a bot guest chat query handler with a filter
|
|
511
|
+
*
|
|
512
|
+
* @param filter Update filter
|
|
513
|
+
* @param handler Bot guest chat query handler
|
|
514
|
+
* @param group Handler group index
|
|
515
|
+
*/
|
|
516
|
+
onBotGuestChatQuery<Mod>(filter: UpdateFilter<BotGuestChatQueryContext, Mod>, handler: BotGuestChatQueryHandler<filters.Modify<BotGuestChatQueryContext, Mod>>['callback'], group?: number): void;
|
|
502
517
|
/**
|
|
503
518
|
* Register a chosen inline result handler without any filters
|
|
504
519
|
*
|
package/dispatcher.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { BotReactionCountUpdate, BotReactionUpdate, BotStoppedUpdate, BusinessCo
|
|
|
2
2
|
import { TelegramClient } from '@mtcute/core/client.js';
|
|
3
3
|
import { UpdateContext } from './context/base.js';
|
|
4
4
|
import { BusinessMessageContext } from './context/business-message.js';
|
|
5
|
-
import { BusinessCallbackQueryContext, CallbackQueryContext, ChatJoinRequestUpdateContext, ChosenInlineResultContext, InlineCallbackQueryContext, InlineQueryContext, MessageContext, PreCheckoutQueryContext } from './context/index.js';
|
|
5
|
+
import { BotGuestChatQueryContext, BusinessCallbackQueryContext, CallbackQueryContext, ChatJoinRequestUpdateContext, ChosenInlineResultContext, InlineCallbackQueryContext, InlineQueryContext, MessageContext, PreCheckoutQueryContext } from './context/index.js';
|
|
6
6
|
import { filters, UpdateFilter } from './filters/index.js';
|
|
7
|
-
import { BotChatJoinRequestHandler, BotReactionCountUpdateHandler, BotReactionUpdateHandler, BotStoppedHandler, BusinessCallbackQueryHandler, BusinessConnectionUpdateHandler, BusinessMessageGroupHandler, CallbackQueryHandler, ChatJoinRequestHandler, ChatMemberUpdateHandler, ChosenInlineResultHandler, DeleteBusinessMessageHandler, DeleteMessageHandler, DeleteStoryHandler, EditBusinessMessageHandler, EditMessageHandler, HistoryReadHandler, InlineCallbackQueryHandler, InlineQueryHandler, MessageGroupHandler, NewBusinessMessageHandler, NewMessageHandler, PollUpdateHandler, PollVoteHandler, PreCheckoutQueryHandler, RawUpdateHandler, StoryUpdateHandler, UpdateHandler, UserStatusUpdateHandler, UserTypingHandler } from './handler.js';
|
|
7
|
+
import { BotChatJoinRequestHandler, BotGuestChatQueryHandler, BotReactionCountUpdateHandler, BotReactionUpdateHandler, BotStoppedHandler, BusinessCallbackQueryHandler, BusinessConnectionUpdateHandler, BusinessMessageGroupHandler, CallbackQueryHandler, ChatJoinRequestHandler, ChatMemberUpdateHandler, ChosenInlineResultHandler, DeleteBusinessMessageHandler, DeleteMessageHandler, DeleteStoryHandler, EditBusinessMessageHandler, EditMessageHandler, HistoryReadHandler, InlineCallbackQueryHandler, InlineQueryHandler, MessageGroupHandler, NewBusinessMessageHandler, NewMessageHandler, PollUpdateHandler, PollVoteHandler, PreCheckoutQueryHandler, RawUpdateHandler, StoryUpdateHandler, UpdateHandler, UserStatusUpdateHandler, UserTypingHandler } from './handler.js';
|
|
8
8
|
import { PropagationAction } from './propagation.js';
|
|
9
9
|
import { IStateStorageProvider, StateKeyDelegate, UpdateState } from './state/index.js';
|
|
10
10
|
import { SceneTransitionContext } from './context/scene-transition.js';
|
|
@@ -499,6 +499,21 @@ export declare class Dispatcher<State extends object = never> {
|
|
|
499
499
|
* @param group Handler group index
|
|
500
500
|
*/
|
|
501
501
|
onInlineQuery<Mod>(filter: UpdateFilter<InlineQueryContext, Mod>, handler: InlineQueryHandler<filters.Modify<InlineQueryContext, Mod>>['callback'], group?: number): void;
|
|
502
|
+
/**
|
|
503
|
+
* Register a bot guest chat query handler without any filters
|
|
504
|
+
*
|
|
505
|
+
* @param handler Bot guest chat query handler
|
|
506
|
+
* @param group Handler group index
|
|
507
|
+
*/
|
|
508
|
+
onBotGuestChatQuery(handler: BotGuestChatQueryHandler['callback'], group?: number): void;
|
|
509
|
+
/**
|
|
510
|
+
* Register a bot guest chat query handler with a filter
|
|
511
|
+
*
|
|
512
|
+
* @param filter Update filter
|
|
513
|
+
* @param handler Bot guest chat query handler
|
|
514
|
+
* @param group Handler group index
|
|
515
|
+
*/
|
|
516
|
+
onBotGuestChatQuery<Mod>(filter: UpdateFilter<BotGuestChatQueryContext, Mod>, handler: BotGuestChatQueryHandler<filters.Modify<BotGuestChatQueryContext, Mod>>['callback'], group?: number): void;
|
|
502
517
|
/**
|
|
503
518
|
* Register a chosen inline result handler without any filters
|
|
504
519
|
*
|
package/dispatcher.js
CHANGED
|
@@ -777,6 +777,10 @@ class Dispatcher {
|
|
|
777
777
|
this._addKnownHandler("inline_query", filter, handler, group);
|
|
778
778
|
}
|
|
779
779
|
/** @internal */
|
|
780
|
+
onBotGuestChatQuery(filter, handler, group) {
|
|
781
|
+
this._addKnownHandler("bot_guest_chat_query", filter, handler, group);
|
|
782
|
+
}
|
|
783
|
+
/** @internal */
|
|
780
784
|
onChosenInlineResult(filter, handler, group) {
|
|
781
785
|
this._addKnownHandler("chosen_inline_result", filter, handler, group);
|
|
782
786
|
}
|
package/handler.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BotReactionCountUpdate, BotReactionUpdate, BotStoppedUpdate, BusinessConnection, ChatJoinRequestUpdate, ChatMemberUpdate, DeleteBusinessMessageUpdate, DeleteMessageUpdate, DeleteStoryUpdate, HistoryReadUpdate, MaybePromise, PeersIndex, PollUpdate, PollVoteUpdate, StoryUpdate, tl, UserStatusUpdate, UserTypingUpdate } from '@mtcute/core';
|
|
2
2
|
import { TelegramClient } from '@mtcute/core/client.js';
|
|
3
3
|
import { UpdateContext } from './context/base.js';
|
|
4
|
-
import { BusinessCallbackQueryContext, BusinessMessageContext, CallbackQueryContext, ChatJoinRequestUpdateContext, ChosenInlineResultContext, InlineCallbackQueryContext, InlineQueryContext, MessageContext, PreCheckoutQueryContext } from './context/index.js';
|
|
4
|
+
import { BotGuestChatQueryContext, BusinessCallbackQueryContext, BusinessMessageContext, CallbackQueryContext, ChatJoinRequestUpdateContext, ChosenInlineResultContext, InlineCallbackQueryContext, InlineQueryContext, MessageContext, PreCheckoutQueryContext } from './context/index.js';
|
|
5
5
|
import { PropagationAction } from './propagation.js';
|
|
6
6
|
export interface BaseUpdateHandler<Name, Handler, Checker> {
|
|
7
7
|
name: Name;
|
|
@@ -16,6 +16,7 @@ export type MessageGroupHandler<T = MessageContext, S = never> = ParsedUpdateHan
|
|
|
16
16
|
export type DeleteMessageHandler<T = UpdateContext<DeleteMessageUpdate>> = ParsedUpdateHandler<'delete_message', T>;
|
|
17
17
|
export type ChatMemberUpdateHandler<T = UpdateContext<ChatMemberUpdate>> = ParsedUpdateHandler<'chat_member', T>;
|
|
18
18
|
export type InlineQueryHandler<T = InlineQueryContext> = ParsedUpdateHandler<'inline_query', T>;
|
|
19
|
+
export type BotGuestChatQueryHandler<T = BotGuestChatQueryContext> = ParsedUpdateHandler<'bot_guest_chat_query', T>;
|
|
19
20
|
export type ChosenInlineResultHandler<T = ChosenInlineResultContext> = ParsedUpdateHandler<'chosen_inline_result', T>;
|
|
20
21
|
export type CallbackQueryHandler<T = CallbackQueryContext, S = never> = ParsedUpdateHandler<'callback_query', T, S>;
|
|
21
22
|
export type InlineCallbackQueryHandler<T = InlineCallbackQueryContext, S = never> = ParsedUpdateHandler<'inline_callback_query', T, S>;
|
|
@@ -38,4 +39,4 @@ export type NewBusinessMessageHandler<T = BusinessMessageContext, S = never> = P
|
|
|
38
39
|
export type EditBusinessMessageHandler<T = BusinessMessageContext, S = never> = ParsedUpdateHandler<'edit_business_message', T, S>;
|
|
39
40
|
export type BusinessMessageGroupHandler<T = BusinessMessageContext, S = never> = ParsedUpdateHandler<'business_message_group', T, S>;
|
|
40
41
|
export type DeleteBusinessMessageHandler<T = UpdateContext<DeleteBusinessMessageUpdate>> = ParsedUpdateHandler<'delete_business_message', T>;
|
|
41
|
-
export type UpdateHandler = RawUpdateHandler | NewMessageHandler | EditMessageHandler | MessageGroupHandler | DeleteMessageHandler | ChatMemberUpdateHandler | InlineQueryHandler | ChosenInlineResultHandler | CallbackQueryHandler | InlineCallbackQueryHandler | BusinessCallbackQueryHandler | PollUpdateHandler | PollVoteHandler | UserStatusUpdateHandler | UserTypingHandler | HistoryReadHandler | BotStoppedHandler | BotChatJoinRequestHandler | ChatJoinRequestHandler | PreCheckoutQueryHandler | StoryUpdateHandler | DeleteStoryHandler | BotReactionUpdateHandler | BotReactionCountUpdateHandler | BusinessConnectionUpdateHandler | NewBusinessMessageHandler | EditBusinessMessageHandler | BusinessMessageGroupHandler | DeleteBusinessMessageHandler;
|
|
42
|
+
export type UpdateHandler = RawUpdateHandler | NewMessageHandler | EditMessageHandler | MessageGroupHandler | DeleteMessageHandler | ChatMemberUpdateHandler | InlineQueryHandler | BotGuestChatQueryHandler | ChosenInlineResultHandler | CallbackQueryHandler | InlineCallbackQueryHandler | BusinessCallbackQueryHandler | PollUpdateHandler | PollVoteHandler | UserStatusUpdateHandler | UserTypingHandler | HistoryReadHandler | BotStoppedHandler | BotChatJoinRequestHandler | ChatJoinRequestHandler | PreCheckoutQueryHandler | StoryUpdateHandler | DeleteStoryHandler | BotReactionUpdateHandler | BotReactionCountUpdateHandler | BusinessConnectionUpdateHandler | NewBusinessMessageHandler | EditBusinessMessageHandler | BusinessMessageGroupHandler | DeleteBusinessMessageHandler;
|
package/handler.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BotReactionCountUpdate, BotReactionUpdate, BotStoppedUpdate, BusinessConnection, ChatJoinRequestUpdate, ChatMemberUpdate, DeleteBusinessMessageUpdate, DeleteMessageUpdate, DeleteStoryUpdate, HistoryReadUpdate, MaybePromise, PeersIndex, PollUpdate, PollVoteUpdate, StoryUpdate, tl, UserStatusUpdate, UserTypingUpdate } from '@mtcute/core';
|
|
2
2
|
import { TelegramClient } from '@mtcute/core/client.js';
|
|
3
3
|
import { UpdateContext } from './context/base.js';
|
|
4
|
-
import { BusinessCallbackQueryContext, BusinessMessageContext, CallbackQueryContext, ChatJoinRequestUpdateContext, ChosenInlineResultContext, InlineCallbackQueryContext, InlineQueryContext, MessageContext, PreCheckoutQueryContext } from './context/index.js';
|
|
4
|
+
import { BotGuestChatQueryContext, BusinessCallbackQueryContext, BusinessMessageContext, CallbackQueryContext, ChatJoinRequestUpdateContext, ChosenInlineResultContext, InlineCallbackQueryContext, InlineQueryContext, MessageContext, PreCheckoutQueryContext } from './context/index.js';
|
|
5
5
|
import { PropagationAction } from './propagation.js';
|
|
6
6
|
export interface BaseUpdateHandler<Name, Handler, Checker> {
|
|
7
7
|
name: Name;
|
|
@@ -16,6 +16,7 @@ export type MessageGroupHandler<T = MessageContext, S = never> = ParsedUpdateHan
|
|
|
16
16
|
export type DeleteMessageHandler<T = UpdateContext<DeleteMessageUpdate>> = ParsedUpdateHandler<'delete_message', T>;
|
|
17
17
|
export type ChatMemberUpdateHandler<T = UpdateContext<ChatMemberUpdate>> = ParsedUpdateHandler<'chat_member', T>;
|
|
18
18
|
export type InlineQueryHandler<T = InlineQueryContext> = ParsedUpdateHandler<'inline_query', T>;
|
|
19
|
+
export type BotGuestChatQueryHandler<T = BotGuestChatQueryContext> = ParsedUpdateHandler<'bot_guest_chat_query', T>;
|
|
19
20
|
export type ChosenInlineResultHandler<T = ChosenInlineResultContext> = ParsedUpdateHandler<'chosen_inline_result', T>;
|
|
20
21
|
export type CallbackQueryHandler<T = CallbackQueryContext, S = never> = ParsedUpdateHandler<'callback_query', T, S>;
|
|
21
22
|
export type InlineCallbackQueryHandler<T = InlineCallbackQueryContext, S = never> = ParsedUpdateHandler<'inline_callback_query', T, S>;
|
|
@@ -38,4 +39,4 @@ export type NewBusinessMessageHandler<T = BusinessMessageContext, S = never> = P
|
|
|
38
39
|
export type EditBusinessMessageHandler<T = BusinessMessageContext, S = never> = ParsedUpdateHandler<'edit_business_message', T, S>;
|
|
39
40
|
export type BusinessMessageGroupHandler<T = BusinessMessageContext, S = never> = ParsedUpdateHandler<'business_message_group', T, S>;
|
|
40
41
|
export type DeleteBusinessMessageHandler<T = UpdateContext<DeleteBusinessMessageUpdate>> = ParsedUpdateHandler<'delete_business_message', T>;
|
|
41
|
-
export type UpdateHandler = RawUpdateHandler | NewMessageHandler | EditMessageHandler | MessageGroupHandler | DeleteMessageHandler | ChatMemberUpdateHandler | InlineQueryHandler | ChosenInlineResultHandler | CallbackQueryHandler | InlineCallbackQueryHandler | BusinessCallbackQueryHandler | PollUpdateHandler | PollVoteHandler | UserStatusUpdateHandler | UserTypingHandler | HistoryReadHandler | BotStoppedHandler | BotChatJoinRequestHandler | ChatJoinRequestHandler | PreCheckoutQueryHandler | StoryUpdateHandler | DeleteStoryHandler | BotReactionUpdateHandler | BotReactionCountUpdateHandler | BusinessConnectionUpdateHandler | NewBusinessMessageHandler | EditBusinessMessageHandler | BusinessMessageGroupHandler | DeleteBusinessMessageHandler;
|
|
42
|
+
export type UpdateHandler = RawUpdateHandler | NewMessageHandler | EditMessageHandler | MessageGroupHandler | DeleteMessageHandler | ChatMemberUpdateHandler | InlineQueryHandler | BotGuestChatQueryHandler | ChosenInlineResultHandler | CallbackQueryHandler | InlineCallbackQueryHandler | BusinessCallbackQueryHandler | PollUpdateHandler | PollVoteHandler | UserStatusUpdateHandler | UserTypingHandler | HistoryReadHandler | BotStoppedHandler | BotChatJoinRequestHandler | ChatJoinRequestHandler | PreCheckoutQueryHandler | StoryUpdateHandler | DeleteStoryHandler | BotReactionUpdateHandler | BotReactionCountUpdateHandler | BusinessConnectionUpdateHandler | NewBusinessMessageHandler | EditBusinessMessageHandler | BusinessMessageGroupHandler | DeleteBusinessMessageHandler;
|
package/index.cjs
CHANGED
|
@@ -9,6 +9,7 @@ const callbackDataBuilder = require("./callback-data-builder.cjs");
|
|
|
9
9
|
const dispatcher = require("./dispatcher.cjs");
|
|
10
10
|
const propagation = require("./propagation.cjs");
|
|
11
11
|
const wizard = require("./wizard.cjs");
|
|
12
|
+
const botGuestChatQuery = require("./context/bot-guest-chat-query.cjs");
|
|
12
13
|
const businessMessage = require("./context/business-message.cjs");
|
|
13
14
|
const callbackQuery = require("./context/callback-query.cjs");
|
|
14
15
|
const chatJoinRequest = require("./context/chat-join-request.cjs");
|
|
@@ -26,6 +27,7 @@ exports.Dispatcher = dispatcher.Dispatcher;
|
|
|
26
27
|
exports.PropagationAction = propagation.PropagationAction;
|
|
27
28
|
exports.WizardScene = wizard.WizardScene;
|
|
28
29
|
exports.WizardSceneAction = wizard.WizardSceneAction;
|
|
30
|
+
exports.BotGuestChatQueryContext = botGuestChatQuery.BotGuestChatQueryContext;
|
|
29
31
|
exports.BusinessMessageContext = businessMessage.BusinessMessageContext;
|
|
30
32
|
exports.BusinessCallbackQueryContext = callbackQuery.BusinessCallbackQueryContext;
|
|
31
33
|
exports.CallbackQueryContext = callbackQuery.CallbackQueryContext;
|
package/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { CallbackDataBuilder } from "./callback-data-builder.js";
|
|
|
2
2
|
import { Dispatcher } from "./dispatcher.js";
|
|
3
3
|
import { PropagationAction } from "./propagation.js";
|
|
4
4
|
import { WizardScene, WizardSceneAction } from "./wizard.js";
|
|
5
|
+
import { BotGuestChatQueryContext } from "./context/bot-guest-chat-query.js";
|
|
5
6
|
import { BusinessMessageContext } from "./context/business-message.js";
|
|
6
7
|
import { BusinessCallbackQueryContext, CallbackQueryContext, InlineCallbackQueryContext } from "./context/callback-query.js";
|
|
7
8
|
import { ChatJoinRequestUpdateContext } from "./context/chat-join-request.js";
|
|
@@ -15,6 +16,7 @@ import { MemoryStateStorage } from "./state/providers/memory.js";
|
|
|
15
16
|
import { SqliteStateStorage } from "./state/providers/sqlite.js";
|
|
16
17
|
import { RateLimitError, UpdateState } from "./state/update-state.js";
|
|
17
18
|
export {
|
|
19
|
+
BotGuestChatQueryContext,
|
|
18
20
|
BusinessCallbackQueryContext,
|
|
19
21
|
BusinessMessageContext,
|
|
20
22
|
CallbackDataBuilder,
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mtcute/dispatcher",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.29.
|
|
4
|
+
"version": "0.29.7",
|
|
5
5
|
"description": "Updates dispatcher and bot framework for @mtcute/client",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@mtcute/core": "^0.29.
|
|
9
|
+
"@mtcute/core": "^0.29.7",
|
|
10
10
|
"@fuman/utils": "0.0.19"
|
|
11
11
|
},
|
|
12
12
|
"exports": {
|