gramio 0.5.0 → 0.6.1

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/dist/index.d.cts CHANGED
@@ -2,17 +2,17 @@ import * as _gramio_callback_data from '@gramio/callback-data';
2
2
  import { CallbackData } from '@gramio/callback-data';
3
3
  export * from '@gramio/callback-data';
4
4
  import * as _gramio_contexts from '@gramio/contexts';
5
- import { Context, ContextsMapping, BotLike, UpdateName, ContextType, Attachment } from '@gramio/contexts';
5
+ import { Context, ContextsMapping, BotLike, UpdateName, ContextType, Attachment, AttachmentsMapping, Dice, MessageOriginUser, MessageOriginChat, MessageOriginChannel, MessageOriginHiddenUser, Message, MessageEntity, TextQuote, User, LinkPreviewOptions, ExternalReplyInfo, Chat, Giveaway, PaidMediaInfo, Game, StoryAttachment, Venue, MessageContext } from '@gramio/contexts';
6
6
  export * from '@gramio/contexts';
7
7
  export * from '@gramio/files';
8
8
  export * from '@gramio/format';
9
9
  export * from '@gramio/keyboards';
10
10
  import * as _gramio_types from '@gramio/types';
11
- import { APIMethods, TelegramResponseParameters, TelegramAPIResponseError, TelegramReactionTypeEmojiEmoji, TelegramUser, APIMethodParams, APIMethodReturn, SetWebhookParams, TelegramUpdate } from '@gramio/types';
11
+ import { APIMethods, TelegramResponseParameters, TelegramAPIResponseError, TelegramReactionTypeEmojiEmoji, TelegramUser, APIMethodParams, APIMethodReturn, SetWebhookParams, TelegramUpdate, TelegramMessageEntity } from '@gramio/types';
12
12
  export * from '@gramio/types';
13
13
  import * as _gramio_composer from '@gramio/composer';
14
- import { EventComposer, Next, EventQueue } from '@gramio/composer';
15
- export { EventComposer, EventQueue, Middleware, Next, compose, noopNext, skip, stop } from '@gramio/composer';
14
+ import { ComposerLike, MacroDefinitions, EventContextOf, EventComposer, MacroDef, Next, EventQueue, HandlerOptions, DeriveFromOptions } from '@gramio/composer';
15
+ export { ContextCallback, DeriveFromOptions, EventComposer, EventQueue, HandlerOptions, MacroDef, MacroDefinitions, MacroDeriveType, MacroHooks, MacroOptionType, Middleware, Next, WithCtx, buildFromOptions, compose, noopNext, skip, stop } from '@gramio/composer';
16
16
 
17
17
  /** Symbol to determine which error kind is it */
18
18
  declare const ErrorKind: symbol;
@@ -37,36 +37,55 @@ type TelegramEventMap = {
37
37
  };
38
38
  /** Concrete context type without GetDerives (which collapses to any with AnyBot) */
39
39
  type Ctx<K extends keyof ContextsMapping<AnyBot>> = InstanceType<ContextsMapping<AnyBot>[K]>;
40
- /** Teach EventComposer.extend() to accept Plugin with proper type extraction */
40
+ /**
41
+ * Extends `ComposerLike<T>` with the two internal members that method
42
+ * bodies need: macro registry and the cross-method `chosenInlineResult` call.
43
+ */
44
+ type GramIOLike<T> = ComposerLike<T> & {
45
+ "~": {
46
+ macros: MacroDefinitions;
47
+ Derives?: Record<string, object>;
48
+ };
49
+ chosenInlineResult(trigger: any, handler: any, macroOptions?: any): T;
50
+ };
51
+ /** Teach EventComposer about GramIO-specific overloads */
41
52
  declare module "@gramio/composer" {
42
- interface EventComposer<TBase, TEventMap, TIn, TOut, TExposed, TDerives> {
43
- extend<P extends AnyPlugin>(plugin: P): EventComposer<TBase, TEventMap, TIn, TOut & P["_"]["Derives"]["global"], TExposed, TDerives & Omit<P["_"]["Derives"], "global">>;
53
+ interface EventComposer<TBase, TEventMap, TIn, TOut, TExposed, TDerives, TMethods, TMacros> {
54
+ extend<P extends AnyPlugin>(plugin: P): EventComposer<TBase, TEventMap, TIn, TOut & P["_"]["Derives"]["global"], TExposed, TDerives & Omit<P["_"]["Derives"], "global">, TMethods, TMacros & P["_"]["Macros"]>;
44
55
  }
45
56
  }
46
57
  declare const Composer: _gramio_composer.EventComposerConstructor<Context<AnyBot>, TelegramEventMap, {
47
- reaction(trigger: MaybeArray<TelegramReactionTypeEmojiEmoji>, handler: (context: Ctx<"message_reaction">) => unknown): _gramio_composer.EventComposer<Context<AnyBot>, TelegramEventMap, Context<AnyBot>, Context<AnyBot>, {}, {}, /*elided*/ any> & /*elided*/ any;
48
- callbackQuery(trigger: CallbackData | string | RegExp, handler: (context: CallbackQueryShorthandContext<AnyBot, any>) => unknown): _gramio_composer.EventComposer<Context<AnyBot>, TelegramEventMap, Context<AnyBot>, Context<AnyBot>, {}, {}, /*elided*/ any> & /*elided*/ any;
49
- chosenInlineResult(trigger: RegExp | string | ((context: Ctx<"chosen_inline_result">) => boolean), handler: (context: Ctx<"chosen_inline_result"> & {
58
+ reaction<TThis extends GramIOLike<TThis>>(this: TThis, trigger: MaybeArray<TelegramReactionTypeEmojiEmoji>, handler: (context: Ctx<"message_reaction"> & EventContextOf<TThis, "message_reaction">) => unknown, macroOptions?: Record<string, unknown>): TThis;
59
+ callbackQuery<TThis extends GramIOLike<TThis>, Trigger extends CallbackData | string | RegExp>(this: TThis, trigger: Trigger, handler: (context: Ctx<"callback_query"> & {
60
+ queryData: Trigger extends CallbackData ? ReturnType<Trigger["unpack"]> : Trigger extends RegExp ? RegExpMatchArray : never;
61
+ } & EventContextOf<TThis, "callback_query">) => unknown, macroOptions?: Record<string, unknown>): TThis;
62
+ chosenInlineResult<TThis extends GramIOLike<TThis>>(this: TThis, trigger: RegExp | string | ((context: Ctx<"chosen_inline_result">) => boolean), handler: (context: Ctx<"chosen_inline_result"> & {
50
63
  args: RegExpMatchArray | null;
51
- }) => unknown): _gramio_composer.EventComposer<Context<AnyBot>, TelegramEventMap, Context<AnyBot>, Context<AnyBot>, {}, {}, /*elided*/ any> & /*elided*/ any;
52
- inlineQuery(trigger: RegExp | string | ((context: Ctx<"inline_query">) => boolean), handler: (context: Ctx<"inline_query"> & {
64
+ } & EventContextOf<TThis, "chosen_inline_result">) => unknown, macroOptions?: Record<string, unknown>): TThis;
65
+ inlineQuery<TThis extends GramIOLike<TThis>>(this: TThis, trigger: RegExp | string | ((context: Ctx<"inline_query">) => boolean), handler: (context: Ctx<"inline_query"> & {
53
66
  args: RegExpMatchArray | null;
54
- }) => unknown, options?: {
67
+ } & EventContextOf<TThis, "inline_query">) => unknown, options?: {
55
68
  onResult?: (context: Ctx<"chosen_inline_result"> & {
56
69
  args: RegExpMatchArray | null;
57
- }) => unknown;
58
- }): _gramio_composer.EventComposer<Context<AnyBot>, TelegramEventMap, Context<AnyBot>, Context<AnyBot>, {}, {}, /*elided*/ any> & /*elided*/ any;
59
- hears(trigger: RegExp | MaybeArray<string> | ((context: Ctx<"message">) => boolean), handler: (context: Ctx<"message"> & {
70
+ } & EventContextOf<TThis, "chosen_inline_result">) => unknown;
71
+ } & Record<string, unknown>): TThis;
72
+ hears<TThis extends GramIOLike<TThis>>(this: TThis, trigger: RegExp | MaybeArray<string> | ((context: Ctx<"message">) => boolean), handler: (context: Ctx<"message"> & {
60
73
  args: RegExpMatchArray | null;
61
- }) => unknown): _gramio_composer.EventComposer<Context<AnyBot>, TelegramEventMap, Context<AnyBot>, Context<AnyBot>, {}, {}, /*elided*/ any> & /*elided*/ any;
62
- command(command: MaybeArray<string>, handler: (context: Ctx<"message"> & {
74
+ } & EventContextOf<TThis, "message">) => unknown, macroOptions?: Record<string, unknown>): TThis;
75
+ command<TThis extends GramIOLike<TThis>>(this: TThis, command: MaybeArray<string>, handler: (context: Ctx<"message"> & {
63
76
  args: string | null;
64
- }) => unknown): _gramio_composer.EventComposer<Context<AnyBot>, TelegramEventMap, Context<AnyBot>, Context<AnyBot>, {}, {}, /*elided*/ any> & /*elided*/ any;
65
- startParameter(parameter: RegExp | MaybeArray<string>, handler: Handler<Ctx<"message"> & {
77
+ } & EventContextOf<TThis, "message">) => unknown, macroOptions?: Record<string, unknown>): TThis;
78
+ startParameter<TThis extends GramIOLike<TThis>>(this: TThis, parameter: RegExp | MaybeArray<string>, handler: Handler<Ctx<"message"> & {
66
79
  rawStartPayload: string;
67
- }>): _gramio_composer.EventComposer<Context<AnyBot>, TelegramEventMap, Context<AnyBot>, Context<AnyBot>, {}, {}, /*elided*/ any> & /*elided*/ any;
80
+ } & EventContextOf<TThis, "message">>, macroOptions?: Record<string, unknown>): TThis;
68
81
  }>;
69
82
 
83
+ /**
84
+ * Yields the subset of UpdateName whose context type contains all keys from Narrowing.
85
+ */
86
+ type CompatibleUpdates$1<B extends BotLike, Narrowing> = {
87
+ [K in UpdateName]: keyof Narrowing & string extends keyof ContextType<B, K> ? K : never;
88
+ }[UpdateName];
70
89
  /**
71
90
  * `Plugin` is an object from which you can extends in Bot instance and adopt types
72
91
  *
@@ -98,7 +117,7 @@ declare const Composer: _gramio_composer.EventComposerConstructor<Context<AnyBot
98
117
  * });
99
118
  * ```
100
119
  */
101
- declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends DeriveDefinitions = DeriveDefinitions> {
120
+ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends DeriveDefinitions = DeriveDefinitions, Macros extends MacroDefinitions = {}> {
102
121
  /**
103
122
  * @internal
104
123
  * Set of Plugin data
@@ -114,6 +133,8 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
114
133
  Errors: Errors;
115
134
  /** remap generic type. {} in runtime */
116
135
  Derives: Derives;
136
+ /** remap generic type. {} in runtime */
137
+ Macros: Macros;
117
138
  /** Composer */
118
139
  composer: EventComposer<Context<AnyBot>, {
119
140
  callback_query: _gramio_contexts.CallbackQueryContext<AnyBot>;
@@ -190,1085 +211,137 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
190
211
  giveaway_winners: _gramio_contexts.GiveawayWinnersContext<AnyBot>;
191
212
  purchased_paid_media: _gramio_contexts.PaidMediaPurchasedContext<AnyBot>;
192
213
  }, Context<AnyBot>, Context<AnyBot>, {}, {}, {
193
- reaction(trigger: MaybeArray<_gramio_types.TelegramReactionTypeEmojiEmoji>, handler: (context: _gramio_contexts.MessageReactionContext<AnyBot>) => unknown): EventComposer<Context<AnyBot>, {
194
- callback_query: _gramio_contexts.CallbackQueryContext<AnyBot>;
195
- chat_join_request: _gramio_contexts.ChatJoinRequestContext<AnyBot>;
196
- chat_member: _gramio_contexts.ChatMemberContext<AnyBot>;
197
- my_chat_member: _gramio_contexts.ChatMemberContext<AnyBot>;
198
- chosen_inline_result: _gramio_contexts.ChosenInlineResultContext<AnyBot>;
199
- delete_chat_photo: _gramio_contexts.DeleteChatPhotoContext<AnyBot>;
200
- group_chat_created: _gramio_contexts.GroupChatCreatedContext<AnyBot>;
201
- inline_query: _gramio_contexts.InlineQueryContext<AnyBot>;
202
- invoice: _gramio_contexts.InvoiceContext<AnyBot>;
203
- left_chat_member: _gramio_contexts.LeftChatMemberContext<AnyBot>;
204
- location: _gramio_contexts.LocationContext<AnyBot>;
205
- message_auto_delete_timer_changed: _gramio_contexts.MessageAutoDeleteTimerChangedContext<AnyBot>;
206
- message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
207
- channel_post: _gramio_contexts.MessageContext<AnyBot>;
208
- edited_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
209
- edited_channel_post: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
210
- business_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
211
- edited_business_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
212
- deleted_business_messages: _gramio_contexts.BusinessMessagesDeletedContext<AnyBot>;
213
- business_connection: _gramio_contexts.BusinessConnectionContext<AnyBot>;
214
- migrate_from_chat_id: _gramio_contexts.MigrateFromChatIdContext<AnyBot>;
215
- migrate_to_chat_id: _gramio_contexts.MigrateToChatIdContext<AnyBot>;
216
- new_chat_members: _gramio_contexts.NewChatMembersContext<AnyBot>;
217
- new_chat_photo: _gramio_contexts.NewChatPhotoContext<AnyBot>;
218
- new_chat_title: _gramio_contexts.NewChatTitleContext<AnyBot>;
219
- passport_data: _gramio_contexts.PassportDataContext<AnyBot>;
220
- pinned_message: _gramio_contexts.PinnedMessageContext<AnyBot>;
221
- poll_answer: _gramio_contexts.PollAnswerContext<AnyBot>;
222
- poll: _gramio_contexts.PollContext<AnyBot>;
223
- pre_checkout_query: _gramio_contexts.PreCheckoutQueryContext<AnyBot>;
224
- proximity_alert_triggered: _gramio_contexts.ProximityAlertTriggeredContext<AnyBot>;
225
- write_access_allowed: _gramio_contexts.WriteAccessAllowedContext<AnyBot>;
226
- boost_added: _gramio_contexts.BoostAddedContext<AnyBot>;
227
- chat_background_set: _gramio_contexts.ChatBackgroundSetContext<AnyBot>;
228
- checklist_tasks_done: _gramio_contexts.ChecklistTasksDoneContext<AnyBot>;
229
- checklist_tasks_added: _gramio_contexts.ChecklistTasksAddedContext<AnyBot>;
230
- direct_message_price_changed: _gramio_contexts.DirectMessagePriceChangedContext<AnyBot>;
231
- suggested_post_approved: _gramio_contexts.SuggestedPostApprovedContext<AnyBot>;
232
- suggested_post_approval_failed: _gramio_contexts.SuggestedPostApprovalFailedContext<AnyBot>;
233
- suggested_post_declined: _gramio_contexts.SuggestedPostDeclinedContext<AnyBot>;
234
- suggested_post_paid: _gramio_contexts.SuggestedPostPaidContext<AnyBot>;
235
- suggested_post_refunded: _gramio_contexts.SuggestedPostRefundedContext<AnyBot>;
236
- forum_topic_created: _gramio_contexts.ForumTopicCreatedContext<AnyBot>;
237
- forum_topic_edited: _gramio_contexts.ForumTopicEditedContext<AnyBot>;
238
- forum_topic_closed: _gramio_contexts.ForumTopicClosedContext<AnyBot>;
239
- forum_topic_reopened: _gramio_contexts.ForumTopicReopenedContext<AnyBot>;
240
- general_forum_topic_hidden: _gramio_contexts.GeneralForumTopicHiddenContext<AnyBot>;
241
- general_forum_topic_unhidden: _gramio_contexts.GeneralForumTopicUnhiddenContext<AnyBot>;
242
- shipping_query: _gramio_contexts.ShippingQueryContext<AnyBot>;
243
- successful_payment: _gramio_contexts.SuccessfulPaymentContext<AnyBot>;
244
- refunded_payment: _gramio_contexts.RefundedPaymentContext<AnyBot>;
245
- users_shared: _gramio_contexts.UsersSharedContext<AnyBot>;
246
- chat_shared: _gramio_contexts.ChatSharedContext<AnyBot>;
247
- gift: _gramio_contexts.GiftContext<AnyBot>;
248
- gift_upgrade_sent: _gramio_contexts.GiftUpgradeSentContext<AnyBot>;
249
- unique_gift: _gramio_contexts.UniqueGiftContext<AnyBot>;
250
- chat_owner_left: _gramio_contexts.ChatOwnerLeftContext<AnyBot>;
251
- chat_owner_changed: _gramio_contexts.ChatOwnerChangedContext<AnyBot>;
252
- paid_message_price_changed: _gramio_contexts.PaidMessagePriceChangedContext<AnyBot>;
253
- video_chat_ended: _gramio_contexts.VideoChatEndedContext<AnyBot>;
254
- video_chat_participants_invited: _gramio_contexts.VideoChatParticipantsInvitedContext<AnyBot>;
255
- video_chat_scheduled: _gramio_contexts.VideoChatScheduledContext<AnyBot>;
256
- video_chat_started: _gramio_contexts.VideoChatStartedContext<AnyBot>;
257
- web_app_data: _gramio_contexts.WebAppDataContext<AnyBot>;
258
- service_message: _gramio_contexts.MessageContext<AnyBot>;
259
- message_reaction: _gramio_contexts.MessageReactionContext<AnyBot>;
260
- message_reaction_count: _gramio_contexts.MessageReactionCountContext<AnyBot>;
261
- chat_boost: _gramio_contexts.ChatBoostContext<AnyBot>;
262
- removed_chat_boost: _gramio_contexts.RemovedChatBoostContext<AnyBot>;
263
- giveaway_created: _gramio_contexts.GiveawayCreatedContext<AnyBot>;
264
- giveaway_completed: _gramio_contexts.GiveawayCompletedContext<AnyBot>;
265
- giveaway_winners: _gramio_contexts.GiveawayWinnersContext<AnyBot>;
266
- purchased_paid_media: _gramio_contexts.PaidMediaPurchasedContext<AnyBot>;
267
- }, Context<AnyBot>, Context<AnyBot>, {}, {}, /*elided*/ any> & /*elided*/ any;
268
- callbackQuery(trigger: _gramio_callback_data.CallbackData | string | RegExp, handler: (context: CallbackQueryShorthandContext<AnyBot, any>) => unknown): EventComposer<Context<AnyBot>, {
269
- callback_query: _gramio_contexts.CallbackQueryContext<AnyBot>;
270
- chat_join_request: _gramio_contexts.ChatJoinRequestContext<AnyBot>;
271
- chat_member: _gramio_contexts.ChatMemberContext<AnyBot>;
272
- my_chat_member: _gramio_contexts.ChatMemberContext<AnyBot>;
273
- chosen_inline_result: _gramio_contexts.ChosenInlineResultContext<AnyBot>;
274
- delete_chat_photo: _gramio_contexts.DeleteChatPhotoContext<AnyBot>;
275
- group_chat_created: _gramio_contexts.GroupChatCreatedContext<AnyBot>;
276
- inline_query: _gramio_contexts.InlineQueryContext<AnyBot>;
277
- invoice: _gramio_contexts.InvoiceContext<AnyBot>;
278
- left_chat_member: _gramio_contexts.LeftChatMemberContext<AnyBot>;
279
- location: _gramio_contexts.LocationContext<AnyBot>;
280
- message_auto_delete_timer_changed: _gramio_contexts.MessageAutoDeleteTimerChangedContext<AnyBot>;
281
- message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
282
- channel_post: _gramio_contexts.MessageContext<AnyBot>;
283
- edited_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
284
- edited_channel_post: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
285
- business_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
286
- edited_business_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
287
- deleted_business_messages: _gramio_contexts.BusinessMessagesDeletedContext<AnyBot>;
288
- business_connection: _gramio_contexts.BusinessConnectionContext<AnyBot>;
289
- migrate_from_chat_id: _gramio_contexts.MigrateFromChatIdContext<AnyBot>;
290
- migrate_to_chat_id: _gramio_contexts.MigrateToChatIdContext<AnyBot>;
291
- new_chat_members: _gramio_contexts.NewChatMembersContext<AnyBot>;
292
- new_chat_photo: _gramio_contexts.NewChatPhotoContext<AnyBot>;
293
- new_chat_title: _gramio_contexts.NewChatTitleContext<AnyBot>;
294
- passport_data: _gramio_contexts.PassportDataContext<AnyBot>;
295
- pinned_message: _gramio_contexts.PinnedMessageContext<AnyBot>;
296
- poll_answer: _gramio_contexts.PollAnswerContext<AnyBot>;
297
- poll: _gramio_contexts.PollContext<AnyBot>;
298
- pre_checkout_query: _gramio_contexts.PreCheckoutQueryContext<AnyBot>;
299
- proximity_alert_triggered: _gramio_contexts.ProximityAlertTriggeredContext<AnyBot>;
300
- write_access_allowed: _gramio_contexts.WriteAccessAllowedContext<AnyBot>;
301
- boost_added: _gramio_contexts.BoostAddedContext<AnyBot>;
302
- chat_background_set: _gramio_contexts.ChatBackgroundSetContext<AnyBot>;
303
- checklist_tasks_done: _gramio_contexts.ChecklistTasksDoneContext<AnyBot>;
304
- checklist_tasks_added: _gramio_contexts.ChecklistTasksAddedContext<AnyBot>;
305
- direct_message_price_changed: _gramio_contexts.DirectMessagePriceChangedContext<AnyBot>;
306
- suggested_post_approved: _gramio_contexts.SuggestedPostApprovedContext<AnyBot>;
307
- suggested_post_approval_failed: _gramio_contexts.SuggestedPostApprovalFailedContext<AnyBot>;
308
- suggested_post_declined: _gramio_contexts.SuggestedPostDeclinedContext<AnyBot>;
309
- suggested_post_paid: _gramio_contexts.SuggestedPostPaidContext<AnyBot>;
310
- suggested_post_refunded: _gramio_contexts.SuggestedPostRefundedContext<AnyBot>;
311
- forum_topic_created: _gramio_contexts.ForumTopicCreatedContext<AnyBot>;
312
- forum_topic_edited: _gramio_contexts.ForumTopicEditedContext<AnyBot>;
313
- forum_topic_closed: _gramio_contexts.ForumTopicClosedContext<AnyBot>;
314
- forum_topic_reopened: _gramio_contexts.ForumTopicReopenedContext<AnyBot>;
315
- general_forum_topic_hidden: _gramio_contexts.GeneralForumTopicHiddenContext<AnyBot>;
316
- general_forum_topic_unhidden: _gramio_contexts.GeneralForumTopicUnhiddenContext<AnyBot>;
317
- shipping_query: _gramio_contexts.ShippingQueryContext<AnyBot>;
318
- successful_payment: _gramio_contexts.SuccessfulPaymentContext<AnyBot>;
319
- refunded_payment: _gramio_contexts.RefundedPaymentContext<AnyBot>;
320
- users_shared: _gramio_contexts.UsersSharedContext<AnyBot>;
321
- chat_shared: _gramio_contexts.ChatSharedContext<AnyBot>;
322
- gift: _gramio_contexts.GiftContext<AnyBot>;
323
- gift_upgrade_sent: _gramio_contexts.GiftUpgradeSentContext<AnyBot>;
324
- unique_gift: _gramio_contexts.UniqueGiftContext<AnyBot>;
325
- chat_owner_left: _gramio_contexts.ChatOwnerLeftContext<AnyBot>;
326
- chat_owner_changed: _gramio_contexts.ChatOwnerChangedContext<AnyBot>;
327
- paid_message_price_changed: _gramio_contexts.PaidMessagePriceChangedContext<AnyBot>;
328
- video_chat_ended: _gramio_contexts.VideoChatEndedContext<AnyBot>;
329
- video_chat_participants_invited: _gramio_contexts.VideoChatParticipantsInvitedContext<AnyBot>;
330
- video_chat_scheduled: _gramio_contexts.VideoChatScheduledContext<AnyBot>;
331
- video_chat_started: _gramio_contexts.VideoChatStartedContext<AnyBot>;
332
- web_app_data: _gramio_contexts.WebAppDataContext<AnyBot>;
333
- service_message: _gramio_contexts.MessageContext<AnyBot>;
334
- message_reaction: _gramio_contexts.MessageReactionContext<AnyBot>;
335
- message_reaction_count: _gramio_contexts.MessageReactionCountContext<AnyBot>;
336
- chat_boost: _gramio_contexts.ChatBoostContext<AnyBot>;
337
- removed_chat_boost: _gramio_contexts.RemovedChatBoostContext<AnyBot>;
338
- giveaway_created: _gramio_contexts.GiveawayCreatedContext<AnyBot>;
339
- giveaway_completed: _gramio_contexts.GiveawayCompletedContext<AnyBot>;
340
- giveaway_winners: _gramio_contexts.GiveawayWinnersContext<AnyBot>;
341
- purchased_paid_media: _gramio_contexts.PaidMediaPurchasedContext<AnyBot>;
342
- }, Context<AnyBot>, Context<AnyBot>, {}, {}, /*elided*/ any> & /*elided*/ any;
343
- chosenInlineResult(trigger: RegExp | string | ((context: _gramio_contexts.ChosenInlineResultContext<AnyBot>) => boolean), handler: (context: _gramio_contexts.ChosenInlineResultContext<AnyBot> & {
214
+ reaction<TThis extends _gramio_composer.ComposerLike<TThis> & {
215
+ "~": {
216
+ macros: MacroDefinitions;
217
+ Derives?: Record<string, object>;
218
+ };
219
+ chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
220
+ }>(this: TThis, trigger: MaybeArray<_gramio_types.TelegramReactionTypeEmojiEmoji>, handler: (context: _gramio_contexts.MessageReactionContext<AnyBot> & _gramio_composer.EventContextOf<TThis, "message_reaction">) => unknown, macroOptions?: Record<string, unknown>): TThis;
221
+ callbackQuery<TThis extends _gramio_composer.ComposerLike<TThis> & {
222
+ "~": {
223
+ macros: MacroDefinitions;
224
+ Derives?: Record<string, object>;
225
+ };
226
+ chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
227
+ }, Trigger extends _gramio_callback_data.CallbackData | string | RegExp>(this: TThis, trigger: Trigger, handler: (context: _gramio_contexts.CallbackQueryContext<AnyBot> & {
228
+ queryData: Trigger extends _gramio_callback_data.CallbackData ? ReturnType<Trigger["unpack"]> : Trigger extends RegExp ? RegExpMatchArray : never;
229
+ } & _gramio_composer.EventContextOf<TThis, "callback_query">) => unknown, macroOptions?: Record<string, unknown>): TThis;
230
+ chosenInlineResult<TThis extends _gramio_composer.ComposerLike<TThis> & {
231
+ "~": {
232
+ macros: MacroDefinitions;
233
+ Derives?: Record<string, object>;
234
+ };
235
+ chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
236
+ }>(this: TThis, trigger: RegExp | string | ((context: _gramio_contexts.ChosenInlineResultContext<AnyBot>) => boolean), handler: (context: _gramio_contexts.ChosenInlineResultContext<AnyBot> & {
344
237
  args: RegExpMatchArray | null;
345
- }) => unknown): EventComposer<Context<AnyBot>, {
346
- callback_query: _gramio_contexts.CallbackQueryContext<AnyBot>;
347
- chat_join_request: _gramio_contexts.ChatJoinRequestContext<AnyBot>;
348
- chat_member: _gramio_contexts.ChatMemberContext<AnyBot>;
349
- my_chat_member: _gramio_contexts.ChatMemberContext<AnyBot>;
350
- chosen_inline_result: _gramio_contexts.ChosenInlineResultContext<AnyBot>;
351
- delete_chat_photo: _gramio_contexts.DeleteChatPhotoContext<AnyBot>;
352
- group_chat_created: _gramio_contexts.GroupChatCreatedContext<AnyBot>;
353
- inline_query: _gramio_contexts.InlineQueryContext<AnyBot>;
354
- invoice: _gramio_contexts.InvoiceContext<AnyBot>;
355
- left_chat_member: _gramio_contexts.LeftChatMemberContext<AnyBot>;
356
- location: _gramio_contexts.LocationContext<AnyBot>;
357
- message_auto_delete_timer_changed: _gramio_contexts.MessageAutoDeleteTimerChangedContext<AnyBot>;
358
- message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
359
- channel_post: _gramio_contexts.MessageContext<AnyBot>;
360
- edited_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
361
- edited_channel_post: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
362
- business_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
363
- edited_business_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
364
- deleted_business_messages: _gramio_contexts.BusinessMessagesDeletedContext<AnyBot>;
365
- business_connection: _gramio_contexts.BusinessConnectionContext<AnyBot>;
366
- migrate_from_chat_id: _gramio_contexts.MigrateFromChatIdContext<AnyBot>;
367
- migrate_to_chat_id: _gramio_contexts.MigrateToChatIdContext<AnyBot>;
368
- new_chat_members: _gramio_contexts.NewChatMembersContext<AnyBot>;
369
- new_chat_photo: _gramio_contexts.NewChatPhotoContext<AnyBot>;
370
- new_chat_title: _gramio_contexts.NewChatTitleContext<AnyBot>;
371
- passport_data: _gramio_contexts.PassportDataContext<AnyBot>;
372
- pinned_message: _gramio_contexts.PinnedMessageContext<AnyBot>;
373
- poll_answer: _gramio_contexts.PollAnswerContext<AnyBot>;
374
- poll: _gramio_contexts.PollContext<AnyBot>;
375
- pre_checkout_query: _gramio_contexts.PreCheckoutQueryContext<AnyBot>;
376
- proximity_alert_triggered: _gramio_contexts.ProximityAlertTriggeredContext<AnyBot>;
377
- write_access_allowed: _gramio_contexts.WriteAccessAllowedContext<AnyBot>;
378
- boost_added: _gramio_contexts.BoostAddedContext<AnyBot>;
379
- chat_background_set: _gramio_contexts.ChatBackgroundSetContext<AnyBot>;
380
- checklist_tasks_done: _gramio_contexts.ChecklistTasksDoneContext<AnyBot>;
381
- checklist_tasks_added: _gramio_contexts.ChecklistTasksAddedContext<AnyBot>;
382
- direct_message_price_changed: _gramio_contexts.DirectMessagePriceChangedContext<AnyBot>;
383
- suggested_post_approved: _gramio_contexts.SuggestedPostApprovedContext<AnyBot>;
384
- suggested_post_approval_failed: _gramio_contexts.SuggestedPostApprovalFailedContext<AnyBot>;
385
- suggested_post_declined: _gramio_contexts.SuggestedPostDeclinedContext<AnyBot>;
386
- suggested_post_paid: _gramio_contexts.SuggestedPostPaidContext<AnyBot>;
387
- suggested_post_refunded: _gramio_contexts.SuggestedPostRefundedContext<AnyBot>;
388
- forum_topic_created: _gramio_contexts.ForumTopicCreatedContext<AnyBot>;
389
- forum_topic_edited: _gramio_contexts.ForumTopicEditedContext<AnyBot>;
390
- forum_topic_closed: _gramio_contexts.ForumTopicClosedContext<AnyBot>;
391
- forum_topic_reopened: _gramio_contexts.ForumTopicReopenedContext<AnyBot>;
392
- general_forum_topic_hidden: _gramio_contexts.GeneralForumTopicHiddenContext<AnyBot>;
393
- general_forum_topic_unhidden: _gramio_contexts.GeneralForumTopicUnhiddenContext<AnyBot>;
394
- shipping_query: _gramio_contexts.ShippingQueryContext<AnyBot>;
395
- successful_payment: _gramio_contexts.SuccessfulPaymentContext<AnyBot>;
396
- refunded_payment: _gramio_contexts.RefundedPaymentContext<AnyBot>;
397
- users_shared: _gramio_contexts.UsersSharedContext<AnyBot>;
398
- chat_shared: _gramio_contexts.ChatSharedContext<AnyBot>;
399
- gift: _gramio_contexts.GiftContext<AnyBot>;
400
- gift_upgrade_sent: _gramio_contexts.GiftUpgradeSentContext<AnyBot>;
401
- unique_gift: _gramio_contexts.UniqueGiftContext<AnyBot>;
402
- chat_owner_left: _gramio_contexts.ChatOwnerLeftContext<AnyBot>;
403
- chat_owner_changed: _gramio_contexts.ChatOwnerChangedContext<AnyBot>;
404
- paid_message_price_changed: _gramio_contexts.PaidMessagePriceChangedContext<AnyBot>;
405
- video_chat_ended: _gramio_contexts.VideoChatEndedContext<AnyBot>;
406
- video_chat_participants_invited: _gramio_contexts.VideoChatParticipantsInvitedContext<AnyBot>;
407
- video_chat_scheduled: _gramio_contexts.VideoChatScheduledContext<AnyBot>;
408
- video_chat_started: _gramio_contexts.VideoChatStartedContext<AnyBot>;
409
- web_app_data: _gramio_contexts.WebAppDataContext<AnyBot>;
410
- service_message: _gramio_contexts.MessageContext<AnyBot>;
411
- message_reaction: _gramio_contexts.MessageReactionContext<AnyBot>;
412
- message_reaction_count: _gramio_contexts.MessageReactionCountContext<AnyBot>;
413
- chat_boost: _gramio_contexts.ChatBoostContext<AnyBot>;
414
- removed_chat_boost: _gramio_contexts.RemovedChatBoostContext<AnyBot>;
415
- giveaway_created: _gramio_contexts.GiveawayCreatedContext<AnyBot>;
416
- giveaway_completed: _gramio_contexts.GiveawayCompletedContext<AnyBot>;
417
- giveaway_winners: _gramio_contexts.GiveawayWinnersContext<AnyBot>;
418
- purchased_paid_media: _gramio_contexts.PaidMediaPurchasedContext<AnyBot>;
419
- }, Context<AnyBot>, Context<AnyBot>, {}, {}, /*elided*/ any> & /*elided*/ any;
420
- inlineQuery(trigger: RegExp | string | ((context: _gramio_contexts.InlineQueryContext<AnyBot>) => boolean), handler: (context: _gramio_contexts.InlineQueryContext<AnyBot> & {
238
+ } & _gramio_composer.EventContextOf<TThis, "chosen_inline_result">) => unknown, macroOptions?: Record<string, unknown>): TThis;
239
+ inlineQuery<TThis extends _gramio_composer.ComposerLike<TThis> & {
240
+ "~": {
241
+ macros: MacroDefinitions;
242
+ Derives?: Record<string, object>;
243
+ };
244
+ chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
245
+ }>(this: TThis, trigger: RegExp | string | ((context: _gramio_contexts.InlineQueryContext<AnyBot>) => boolean), handler: (context: _gramio_contexts.InlineQueryContext<AnyBot> & {
421
246
  args: RegExpMatchArray | null;
422
- }) => unknown, options?: {
247
+ } & _gramio_composer.EventContextOf<TThis, "inline_query">) => unknown, options?: {
423
248
  onResult?: (context: _gramio_contexts.ChosenInlineResultContext<AnyBot> & {
424
249
  args: RegExpMatchArray | null;
425
- }) => unknown;
426
- }): EventComposer<Context<AnyBot>, {
427
- callback_query: _gramio_contexts.CallbackQueryContext<AnyBot>;
428
- chat_join_request: _gramio_contexts.ChatJoinRequestContext<AnyBot>;
429
- chat_member: _gramio_contexts.ChatMemberContext<AnyBot>;
430
- my_chat_member: _gramio_contexts.ChatMemberContext<AnyBot>;
431
- chosen_inline_result: _gramio_contexts.ChosenInlineResultContext<AnyBot>;
432
- delete_chat_photo: _gramio_contexts.DeleteChatPhotoContext<AnyBot>;
433
- group_chat_created: _gramio_contexts.GroupChatCreatedContext<AnyBot>;
434
- inline_query: _gramio_contexts.InlineQueryContext<AnyBot>;
435
- invoice: _gramio_contexts.InvoiceContext<AnyBot>;
436
- left_chat_member: _gramio_contexts.LeftChatMemberContext<AnyBot>;
437
- location: _gramio_contexts.LocationContext<AnyBot>;
438
- message_auto_delete_timer_changed: _gramio_contexts.MessageAutoDeleteTimerChangedContext<AnyBot>;
439
- message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
440
- channel_post: _gramio_contexts.MessageContext<AnyBot>;
441
- edited_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
442
- edited_channel_post: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
443
- business_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
444
- edited_business_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
445
- deleted_business_messages: _gramio_contexts.BusinessMessagesDeletedContext<AnyBot>;
446
- business_connection: _gramio_contexts.BusinessConnectionContext<AnyBot>;
447
- migrate_from_chat_id: _gramio_contexts.MigrateFromChatIdContext<AnyBot>;
448
- migrate_to_chat_id: _gramio_contexts.MigrateToChatIdContext<AnyBot>;
449
- new_chat_members: _gramio_contexts.NewChatMembersContext<AnyBot>;
450
- new_chat_photo: _gramio_contexts.NewChatPhotoContext<AnyBot>;
451
- new_chat_title: _gramio_contexts.NewChatTitleContext<AnyBot>;
452
- passport_data: _gramio_contexts.PassportDataContext<AnyBot>;
453
- pinned_message: _gramio_contexts.PinnedMessageContext<AnyBot>;
454
- poll_answer: _gramio_contexts.PollAnswerContext<AnyBot>;
455
- poll: _gramio_contexts.PollContext<AnyBot>;
456
- pre_checkout_query: _gramio_contexts.PreCheckoutQueryContext<AnyBot>;
457
- proximity_alert_triggered: _gramio_contexts.ProximityAlertTriggeredContext<AnyBot>;
458
- write_access_allowed: _gramio_contexts.WriteAccessAllowedContext<AnyBot>;
459
- boost_added: _gramio_contexts.BoostAddedContext<AnyBot>;
460
- chat_background_set: _gramio_contexts.ChatBackgroundSetContext<AnyBot>;
461
- checklist_tasks_done: _gramio_contexts.ChecklistTasksDoneContext<AnyBot>;
462
- checklist_tasks_added: _gramio_contexts.ChecklistTasksAddedContext<AnyBot>;
463
- direct_message_price_changed: _gramio_contexts.DirectMessagePriceChangedContext<AnyBot>;
464
- suggested_post_approved: _gramio_contexts.SuggestedPostApprovedContext<AnyBot>;
465
- suggested_post_approval_failed: _gramio_contexts.SuggestedPostApprovalFailedContext<AnyBot>;
466
- suggested_post_declined: _gramio_contexts.SuggestedPostDeclinedContext<AnyBot>;
467
- suggested_post_paid: _gramio_contexts.SuggestedPostPaidContext<AnyBot>;
468
- suggested_post_refunded: _gramio_contexts.SuggestedPostRefundedContext<AnyBot>;
469
- forum_topic_created: _gramio_contexts.ForumTopicCreatedContext<AnyBot>;
470
- forum_topic_edited: _gramio_contexts.ForumTopicEditedContext<AnyBot>;
471
- forum_topic_closed: _gramio_contexts.ForumTopicClosedContext<AnyBot>;
472
- forum_topic_reopened: _gramio_contexts.ForumTopicReopenedContext<AnyBot>;
473
- general_forum_topic_hidden: _gramio_contexts.GeneralForumTopicHiddenContext<AnyBot>;
474
- general_forum_topic_unhidden: _gramio_contexts.GeneralForumTopicUnhiddenContext<AnyBot>;
475
- shipping_query: _gramio_contexts.ShippingQueryContext<AnyBot>;
476
- successful_payment: _gramio_contexts.SuccessfulPaymentContext<AnyBot>;
477
- refunded_payment: _gramio_contexts.RefundedPaymentContext<AnyBot>;
478
- users_shared: _gramio_contexts.UsersSharedContext<AnyBot>;
479
- chat_shared: _gramio_contexts.ChatSharedContext<AnyBot>;
480
- gift: _gramio_contexts.GiftContext<AnyBot>;
481
- gift_upgrade_sent: _gramio_contexts.GiftUpgradeSentContext<AnyBot>;
482
- unique_gift: _gramio_contexts.UniqueGiftContext<AnyBot>;
483
- chat_owner_left: _gramio_contexts.ChatOwnerLeftContext<AnyBot>;
484
- chat_owner_changed: _gramio_contexts.ChatOwnerChangedContext<AnyBot>;
485
- paid_message_price_changed: _gramio_contexts.PaidMessagePriceChangedContext<AnyBot>;
486
- video_chat_ended: _gramio_contexts.VideoChatEndedContext<AnyBot>;
487
- video_chat_participants_invited: _gramio_contexts.VideoChatParticipantsInvitedContext<AnyBot>;
488
- video_chat_scheduled: _gramio_contexts.VideoChatScheduledContext<AnyBot>;
489
- video_chat_started: _gramio_contexts.VideoChatStartedContext<AnyBot>;
490
- web_app_data: _gramio_contexts.WebAppDataContext<AnyBot>;
491
- service_message: _gramio_contexts.MessageContext<AnyBot>;
492
- message_reaction: _gramio_contexts.MessageReactionContext<AnyBot>;
493
- message_reaction_count: _gramio_contexts.MessageReactionCountContext<AnyBot>;
494
- chat_boost: _gramio_contexts.ChatBoostContext<AnyBot>;
495
- removed_chat_boost: _gramio_contexts.RemovedChatBoostContext<AnyBot>;
496
- giveaway_created: _gramio_contexts.GiveawayCreatedContext<AnyBot>;
497
- giveaway_completed: _gramio_contexts.GiveawayCompletedContext<AnyBot>;
498
- giveaway_winners: _gramio_contexts.GiveawayWinnersContext<AnyBot>;
499
- purchased_paid_media: _gramio_contexts.PaidMediaPurchasedContext<AnyBot>;
500
- }, Context<AnyBot>, Context<AnyBot>, {}, {}, /*elided*/ any> & /*elided*/ any;
501
- hears(trigger: RegExp | MaybeArray<string> | ((context: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) => boolean), handler: (context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
250
+ } & _gramio_composer.EventContextOf<TThis, "chosen_inline_result">) => unknown;
251
+ } & Record<string, unknown>): TThis;
252
+ hears<TThis extends _gramio_composer.ComposerLike<TThis> & {
253
+ "~": {
254
+ macros: MacroDefinitions;
255
+ Derives?: Record<string, object>;
256
+ };
257
+ chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
258
+ }>(this: TThis, trigger: RegExp | MaybeArray<string> | ((context: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) => boolean), handler: (context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
502
259
  args: RegExpMatchArray | null;
503
- }) => unknown): EventComposer<Context<AnyBot>, {
504
- callback_query: _gramio_contexts.CallbackQueryContext<AnyBot>;
505
- chat_join_request: _gramio_contexts.ChatJoinRequestContext<AnyBot>;
506
- chat_member: _gramio_contexts.ChatMemberContext<AnyBot>;
507
- my_chat_member: _gramio_contexts.ChatMemberContext<AnyBot>;
508
- chosen_inline_result: _gramio_contexts.ChosenInlineResultContext<AnyBot>;
509
- delete_chat_photo: _gramio_contexts.DeleteChatPhotoContext<AnyBot>;
510
- group_chat_created: _gramio_contexts.GroupChatCreatedContext<AnyBot>;
511
- inline_query: _gramio_contexts.InlineQueryContext<AnyBot>;
512
- invoice: _gramio_contexts.InvoiceContext<AnyBot>;
513
- left_chat_member: _gramio_contexts.LeftChatMemberContext<AnyBot>;
514
- location: _gramio_contexts.LocationContext<AnyBot>;
515
- message_auto_delete_timer_changed: _gramio_contexts.MessageAutoDeleteTimerChangedContext<AnyBot>;
516
- message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
517
- channel_post: _gramio_contexts.MessageContext<AnyBot>;
518
- edited_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
519
- edited_channel_post: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
520
- business_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
521
- edited_business_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
522
- deleted_business_messages: _gramio_contexts.BusinessMessagesDeletedContext<AnyBot>;
523
- business_connection: _gramio_contexts.BusinessConnectionContext<AnyBot>;
524
- migrate_from_chat_id: _gramio_contexts.MigrateFromChatIdContext<AnyBot>;
525
- migrate_to_chat_id: _gramio_contexts.MigrateToChatIdContext<AnyBot>;
526
- new_chat_members: _gramio_contexts.NewChatMembersContext<AnyBot>;
527
- new_chat_photo: _gramio_contexts.NewChatPhotoContext<AnyBot>;
528
- new_chat_title: _gramio_contexts.NewChatTitleContext<AnyBot>;
529
- passport_data: _gramio_contexts.PassportDataContext<AnyBot>;
530
- pinned_message: _gramio_contexts.PinnedMessageContext<AnyBot>;
531
- poll_answer: _gramio_contexts.PollAnswerContext<AnyBot>;
532
- poll: _gramio_contexts.PollContext<AnyBot>;
533
- pre_checkout_query: _gramio_contexts.PreCheckoutQueryContext<AnyBot>;
534
- proximity_alert_triggered: _gramio_contexts.ProximityAlertTriggeredContext<AnyBot>;
535
- write_access_allowed: _gramio_contexts.WriteAccessAllowedContext<AnyBot>;
536
- boost_added: _gramio_contexts.BoostAddedContext<AnyBot>;
537
- chat_background_set: _gramio_contexts.ChatBackgroundSetContext<AnyBot>;
538
- checklist_tasks_done: _gramio_contexts.ChecklistTasksDoneContext<AnyBot>;
539
- checklist_tasks_added: _gramio_contexts.ChecklistTasksAddedContext<AnyBot>;
540
- direct_message_price_changed: _gramio_contexts.DirectMessagePriceChangedContext<AnyBot>;
541
- suggested_post_approved: _gramio_contexts.SuggestedPostApprovedContext<AnyBot>;
542
- suggested_post_approval_failed: _gramio_contexts.SuggestedPostApprovalFailedContext<AnyBot>;
543
- suggested_post_declined: _gramio_contexts.SuggestedPostDeclinedContext<AnyBot>;
544
- suggested_post_paid: _gramio_contexts.SuggestedPostPaidContext<AnyBot>;
545
- suggested_post_refunded: _gramio_contexts.SuggestedPostRefundedContext<AnyBot>;
546
- forum_topic_created: _gramio_contexts.ForumTopicCreatedContext<AnyBot>;
547
- forum_topic_edited: _gramio_contexts.ForumTopicEditedContext<AnyBot>;
548
- forum_topic_closed: _gramio_contexts.ForumTopicClosedContext<AnyBot>;
549
- forum_topic_reopened: _gramio_contexts.ForumTopicReopenedContext<AnyBot>;
550
- general_forum_topic_hidden: _gramio_contexts.GeneralForumTopicHiddenContext<AnyBot>;
551
- general_forum_topic_unhidden: _gramio_contexts.GeneralForumTopicUnhiddenContext<AnyBot>;
552
- shipping_query: _gramio_contexts.ShippingQueryContext<AnyBot>;
553
- successful_payment: _gramio_contexts.SuccessfulPaymentContext<AnyBot>;
554
- refunded_payment: _gramio_contexts.RefundedPaymentContext<AnyBot>;
555
- users_shared: _gramio_contexts.UsersSharedContext<AnyBot>;
556
- chat_shared: _gramio_contexts.ChatSharedContext<AnyBot>;
557
- gift: _gramio_contexts.GiftContext<AnyBot>;
558
- gift_upgrade_sent: _gramio_contexts.GiftUpgradeSentContext<AnyBot>;
559
- unique_gift: _gramio_contexts.UniqueGiftContext<AnyBot>;
560
- chat_owner_left: _gramio_contexts.ChatOwnerLeftContext<AnyBot>;
561
- chat_owner_changed: _gramio_contexts.ChatOwnerChangedContext<AnyBot>;
562
- paid_message_price_changed: _gramio_contexts.PaidMessagePriceChangedContext<AnyBot>;
563
- video_chat_ended: _gramio_contexts.VideoChatEndedContext<AnyBot>;
564
- video_chat_participants_invited: _gramio_contexts.VideoChatParticipantsInvitedContext<AnyBot>;
565
- video_chat_scheduled: _gramio_contexts.VideoChatScheduledContext<AnyBot>;
566
- video_chat_started: _gramio_contexts.VideoChatStartedContext<AnyBot>;
567
- web_app_data: _gramio_contexts.WebAppDataContext<AnyBot>;
568
- service_message: _gramio_contexts.MessageContext<AnyBot>;
569
- message_reaction: _gramio_contexts.MessageReactionContext<AnyBot>;
570
- message_reaction_count: _gramio_contexts.MessageReactionCountContext<AnyBot>;
571
- chat_boost: _gramio_contexts.ChatBoostContext<AnyBot>;
572
- removed_chat_boost: _gramio_contexts.RemovedChatBoostContext<AnyBot>;
573
- giveaway_created: _gramio_contexts.GiveawayCreatedContext<AnyBot>;
574
- giveaway_completed: _gramio_contexts.GiveawayCompletedContext<AnyBot>;
575
- giveaway_winners: _gramio_contexts.GiveawayWinnersContext<AnyBot>;
576
- purchased_paid_media: _gramio_contexts.PaidMediaPurchasedContext<AnyBot>;
577
- }, Context<AnyBot>, Context<AnyBot>, {}, {}, /*elided*/ any> & /*elided*/ any;
578
- command(command: MaybeArray<string>, handler: (context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
260
+ } & _gramio_composer.EventContextOf<TThis, "message">) => unknown, macroOptions?: Record<string, unknown>): TThis;
261
+ command<TThis extends _gramio_composer.ComposerLike<TThis> & {
262
+ "~": {
263
+ macros: MacroDefinitions;
264
+ Derives?: Record<string, object>;
265
+ };
266
+ chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
267
+ }>(this: TThis, command: MaybeArray<string>, handler: (context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
579
268
  args: string | null;
580
- }) => unknown): EventComposer<Context<AnyBot>, {
581
- callback_query: _gramio_contexts.CallbackQueryContext<AnyBot>;
582
- chat_join_request: _gramio_contexts.ChatJoinRequestContext<AnyBot>;
583
- chat_member: _gramio_contexts.ChatMemberContext<AnyBot>;
584
- my_chat_member: _gramio_contexts.ChatMemberContext<AnyBot>;
585
- chosen_inline_result: _gramio_contexts.ChosenInlineResultContext<AnyBot>;
586
- delete_chat_photo: _gramio_contexts.DeleteChatPhotoContext<AnyBot>;
587
- group_chat_created: _gramio_contexts.GroupChatCreatedContext<AnyBot>;
588
- inline_query: _gramio_contexts.InlineQueryContext<AnyBot>;
589
- invoice: _gramio_contexts.InvoiceContext<AnyBot>;
590
- left_chat_member: _gramio_contexts.LeftChatMemberContext<AnyBot>;
591
- location: _gramio_contexts.LocationContext<AnyBot>;
592
- message_auto_delete_timer_changed: _gramio_contexts.MessageAutoDeleteTimerChangedContext<AnyBot>;
593
- message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
594
- channel_post: _gramio_contexts.MessageContext<AnyBot>;
595
- edited_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
596
- edited_channel_post: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
597
- business_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
598
- edited_business_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
599
- deleted_business_messages: _gramio_contexts.BusinessMessagesDeletedContext<AnyBot>;
600
- business_connection: _gramio_contexts.BusinessConnectionContext<AnyBot>;
601
- migrate_from_chat_id: _gramio_contexts.MigrateFromChatIdContext<AnyBot>;
602
- migrate_to_chat_id: _gramio_contexts.MigrateToChatIdContext<AnyBot>;
603
- new_chat_members: _gramio_contexts.NewChatMembersContext<AnyBot>;
604
- new_chat_photo: _gramio_contexts.NewChatPhotoContext<AnyBot>;
605
- new_chat_title: _gramio_contexts.NewChatTitleContext<AnyBot>;
606
- passport_data: _gramio_contexts.PassportDataContext<AnyBot>;
607
- pinned_message: _gramio_contexts.PinnedMessageContext<AnyBot>;
608
- poll_answer: _gramio_contexts.PollAnswerContext<AnyBot>;
609
- poll: _gramio_contexts.PollContext<AnyBot>;
610
- pre_checkout_query: _gramio_contexts.PreCheckoutQueryContext<AnyBot>;
611
- proximity_alert_triggered: _gramio_contexts.ProximityAlertTriggeredContext<AnyBot>;
612
- write_access_allowed: _gramio_contexts.WriteAccessAllowedContext<AnyBot>;
613
- boost_added: _gramio_contexts.BoostAddedContext<AnyBot>;
614
- chat_background_set: _gramio_contexts.ChatBackgroundSetContext<AnyBot>;
615
- checklist_tasks_done: _gramio_contexts.ChecklistTasksDoneContext<AnyBot>;
616
- checklist_tasks_added: _gramio_contexts.ChecklistTasksAddedContext<AnyBot>;
617
- direct_message_price_changed: _gramio_contexts.DirectMessagePriceChangedContext<AnyBot>;
618
- suggested_post_approved: _gramio_contexts.SuggestedPostApprovedContext<AnyBot>;
619
- suggested_post_approval_failed: _gramio_contexts.SuggestedPostApprovalFailedContext<AnyBot>;
620
- suggested_post_declined: _gramio_contexts.SuggestedPostDeclinedContext<AnyBot>;
621
- suggested_post_paid: _gramio_contexts.SuggestedPostPaidContext<AnyBot>;
622
- suggested_post_refunded: _gramio_contexts.SuggestedPostRefundedContext<AnyBot>;
623
- forum_topic_created: _gramio_contexts.ForumTopicCreatedContext<AnyBot>;
624
- forum_topic_edited: _gramio_contexts.ForumTopicEditedContext<AnyBot>;
625
- forum_topic_closed: _gramio_contexts.ForumTopicClosedContext<AnyBot>;
626
- forum_topic_reopened: _gramio_contexts.ForumTopicReopenedContext<AnyBot>;
627
- general_forum_topic_hidden: _gramio_contexts.GeneralForumTopicHiddenContext<AnyBot>;
628
- general_forum_topic_unhidden: _gramio_contexts.GeneralForumTopicUnhiddenContext<AnyBot>;
629
- shipping_query: _gramio_contexts.ShippingQueryContext<AnyBot>;
630
- successful_payment: _gramio_contexts.SuccessfulPaymentContext<AnyBot>;
631
- refunded_payment: _gramio_contexts.RefundedPaymentContext<AnyBot>;
632
- users_shared: _gramio_contexts.UsersSharedContext<AnyBot>;
633
- chat_shared: _gramio_contexts.ChatSharedContext<AnyBot>;
634
- gift: _gramio_contexts.GiftContext<AnyBot>;
635
- gift_upgrade_sent: _gramio_contexts.GiftUpgradeSentContext<AnyBot>;
636
- unique_gift: _gramio_contexts.UniqueGiftContext<AnyBot>;
637
- chat_owner_left: _gramio_contexts.ChatOwnerLeftContext<AnyBot>;
638
- chat_owner_changed: _gramio_contexts.ChatOwnerChangedContext<AnyBot>;
639
- paid_message_price_changed: _gramio_contexts.PaidMessagePriceChangedContext<AnyBot>;
640
- video_chat_ended: _gramio_contexts.VideoChatEndedContext<AnyBot>;
641
- video_chat_participants_invited: _gramio_contexts.VideoChatParticipantsInvitedContext<AnyBot>;
642
- video_chat_scheduled: _gramio_contexts.VideoChatScheduledContext<AnyBot>;
643
- video_chat_started: _gramio_contexts.VideoChatStartedContext<AnyBot>;
644
- web_app_data: _gramio_contexts.WebAppDataContext<AnyBot>;
645
- service_message: _gramio_contexts.MessageContext<AnyBot>;
646
- message_reaction: _gramio_contexts.MessageReactionContext<AnyBot>;
647
- message_reaction_count: _gramio_contexts.MessageReactionCountContext<AnyBot>;
648
- chat_boost: _gramio_contexts.ChatBoostContext<AnyBot>;
649
- removed_chat_boost: _gramio_contexts.RemovedChatBoostContext<AnyBot>;
650
- giveaway_created: _gramio_contexts.GiveawayCreatedContext<AnyBot>;
651
- giveaway_completed: _gramio_contexts.GiveawayCompletedContext<AnyBot>;
652
- giveaway_winners: _gramio_contexts.GiveawayWinnersContext<AnyBot>;
653
- purchased_paid_media: _gramio_contexts.PaidMediaPurchasedContext<AnyBot>;
654
- }, Context<AnyBot>, Context<AnyBot>, {}, {}, /*elided*/ any> & /*elided*/ any;
655
- startParameter(parameter: RegExp | MaybeArray<string>, handler: Handler<(_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
269
+ } & _gramio_composer.EventContextOf<TThis, "message">) => unknown, macroOptions?: Record<string, unknown>): TThis;
270
+ startParameter<TThis extends _gramio_composer.ComposerLike<TThis> & {
271
+ "~": {
272
+ macros: MacroDefinitions;
273
+ Derives?: Record<string, object>;
274
+ };
275
+ chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
276
+ }>(this: TThis, parameter: RegExp | MaybeArray<string>, handler: Handler<(_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
656
277
  rawStartPayload: string;
657
- }>): EventComposer<Context<AnyBot>, {
658
- callback_query: _gramio_contexts.CallbackQueryContext<AnyBot>;
659
- chat_join_request: _gramio_contexts.ChatJoinRequestContext<AnyBot>;
660
- chat_member: _gramio_contexts.ChatMemberContext<AnyBot>;
661
- my_chat_member: _gramio_contexts.ChatMemberContext<AnyBot>;
662
- chosen_inline_result: _gramio_contexts.ChosenInlineResultContext<AnyBot>;
663
- delete_chat_photo: _gramio_contexts.DeleteChatPhotoContext<AnyBot>;
664
- group_chat_created: _gramio_contexts.GroupChatCreatedContext<AnyBot>;
665
- inline_query: _gramio_contexts.InlineQueryContext<AnyBot>;
666
- invoice: _gramio_contexts.InvoiceContext<AnyBot>;
667
- left_chat_member: _gramio_contexts.LeftChatMemberContext<AnyBot>;
668
- location: _gramio_contexts.LocationContext<AnyBot>;
669
- message_auto_delete_timer_changed: _gramio_contexts.MessageAutoDeleteTimerChangedContext<AnyBot>;
670
- message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
671
- channel_post: _gramio_contexts.MessageContext<AnyBot>;
672
- edited_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
673
- edited_channel_post: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
674
- business_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
675
- edited_business_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
676
- deleted_business_messages: _gramio_contexts.BusinessMessagesDeletedContext<AnyBot>;
677
- business_connection: _gramio_contexts.BusinessConnectionContext<AnyBot>;
678
- migrate_from_chat_id: _gramio_contexts.MigrateFromChatIdContext<AnyBot>;
679
- migrate_to_chat_id: _gramio_contexts.MigrateToChatIdContext<AnyBot>;
680
- new_chat_members: _gramio_contexts.NewChatMembersContext<AnyBot>;
681
- new_chat_photo: _gramio_contexts.NewChatPhotoContext<AnyBot>;
682
- new_chat_title: _gramio_contexts.NewChatTitleContext<AnyBot>;
683
- passport_data: _gramio_contexts.PassportDataContext<AnyBot>;
684
- pinned_message: _gramio_contexts.PinnedMessageContext<AnyBot>;
685
- poll_answer: _gramio_contexts.PollAnswerContext<AnyBot>;
686
- poll: _gramio_contexts.PollContext<AnyBot>;
687
- pre_checkout_query: _gramio_contexts.PreCheckoutQueryContext<AnyBot>;
688
- proximity_alert_triggered: _gramio_contexts.ProximityAlertTriggeredContext<AnyBot>;
689
- write_access_allowed: _gramio_contexts.WriteAccessAllowedContext<AnyBot>;
690
- boost_added: _gramio_contexts.BoostAddedContext<AnyBot>;
691
- chat_background_set: _gramio_contexts.ChatBackgroundSetContext<AnyBot>;
692
- checklist_tasks_done: _gramio_contexts.ChecklistTasksDoneContext<AnyBot>;
693
- checklist_tasks_added: _gramio_contexts.ChecklistTasksAddedContext<AnyBot>;
694
- direct_message_price_changed: _gramio_contexts.DirectMessagePriceChangedContext<AnyBot>;
695
- suggested_post_approved: _gramio_contexts.SuggestedPostApprovedContext<AnyBot>;
696
- suggested_post_approval_failed: _gramio_contexts.SuggestedPostApprovalFailedContext<AnyBot>;
697
- suggested_post_declined: _gramio_contexts.SuggestedPostDeclinedContext<AnyBot>;
698
- suggested_post_paid: _gramio_contexts.SuggestedPostPaidContext<AnyBot>;
699
- suggested_post_refunded: _gramio_contexts.SuggestedPostRefundedContext<AnyBot>;
700
- forum_topic_created: _gramio_contexts.ForumTopicCreatedContext<AnyBot>;
701
- forum_topic_edited: _gramio_contexts.ForumTopicEditedContext<AnyBot>;
702
- forum_topic_closed: _gramio_contexts.ForumTopicClosedContext<AnyBot>;
703
- forum_topic_reopened: _gramio_contexts.ForumTopicReopenedContext<AnyBot>;
704
- general_forum_topic_hidden: _gramio_contexts.GeneralForumTopicHiddenContext<AnyBot>;
705
- general_forum_topic_unhidden: _gramio_contexts.GeneralForumTopicUnhiddenContext<AnyBot>;
706
- shipping_query: _gramio_contexts.ShippingQueryContext<AnyBot>;
707
- successful_payment: _gramio_contexts.SuccessfulPaymentContext<AnyBot>;
708
- refunded_payment: _gramio_contexts.RefundedPaymentContext<AnyBot>;
709
- users_shared: _gramio_contexts.UsersSharedContext<AnyBot>;
710
- chat_shared: _gramio_contexts.ChatSharedContext<AnyBot>;
711
- gift: _gramio_contexts.GiftContext<AnyBot>;
712
- gift_upgrade_sent: _gramio_contexts.GiftUpgradeSentContext<AnyBot>;
713
- unique_gift: _gramio_contexts.UniqueGiftContext<AnyBot>;
714
- chat_owner_left: _gramio_contexts.ChatOwnerLeftContext<AnyBot>;
715
- chat_owner_changed: _gramio_contexts.ChatOwnerChangedContext<AnyBot>;
716
- paid_message_price_changed: _gramio_contexts.PaidMessagePriceChangedContext<AnyBot>;
717
- video_chat_ended: _gramio_contexts.VideoChatEndedContext<AnyBot>;
718
- video_chat_participants_invited: _gramio_contexts.VideoChatParticipantsInvitedContext<AnyBot>;
719
- video_chat_scheduled: _gramio_contexts.VideoChatScheduledContext<AnyBot>;
720
- video_chat_started: _gramio_contexts.VideoChatStartedContext<AnyBot>;
721
- web_app_data: _gramio_contexts.WebAppDataContext<AnyBot>;
722
- service_message: _gramio_contexts.MessageContext<AnyBot>;
723
- message_reaction: _gramio_contexts.MessageReactionContext<AnyBot>;
724
- message_reaction_count: _gramio_contexts.MessageReactionCountContext<AnyBot>;
725
- chat_boost: _gramio_contexts.ChatBoostContext<AnyBot>;
726
- removed_chat_boost: _gramio_contexts.RemovedChatBoostContext<AnyBot>;
727
- giveaway_created: _gramio_contexts.GiveawayCreatedContext<AnyBot>;
728
- giveaway_completed: _gramio_contexts.GiveawayCompletedContext<AnyBot>;
729
- giveaway_winners: _gramio_contexts.GiveawayWinnersContext<AnyBot>;
730
- purchased_paid_media: _gramio_contexts.PaidMediaPurchasedContext<AnyBot>;
731
- }, Context<AnyBot>, Context<AnyBot>, {}, {}, /*elided*/ any> & /*elided*/ any;
732
- }> & {
733
- reaction(trigger: MaybeArray<_gramio_types.TelegramReactionTypeEmojiEmoji>, handler: (context: _gramio_contexts.MessageReactionContext<AnyBot>) => unknown): EventComposer<Context<AnyBot>, {
734
- callback_query: _gramio_contexts.CallbackQueryContext<AnyBot>;
735
- chat_join_request: _gramio_contexts.ChatJoinRequestContext<AnyBot>;
736
- chat_member: _gramio_contexts.ChatMemberContext<AnyBot>;
737
- my_chat_member: _gramio_contexts.ChatMemberContext<AnyBot>;
738
- chosen_inline_result: _gramio_contexts.ChosenInlineResultContext<AnyBot>;
739
- delete_chat_photo: _gramio_contexts.DeleteChatPhotoContext<AnyBot>;
740
- group_chat_created: _gramio_contexts.GroupChatCreatedContext<AnyBot>;
741
- inline_query: _gramio_contexts.InlineQueryContext<AnyBot>;
742
- invoice: _gramio_contexts.InvoiceContext<AnyBot>;
743
- left_chat_member: _gramio_contexts.LeftChatMemberContext<AnyBot>;
744
- location: _gramio_contexts.LocationContext<AnyBot>;
745
- message_auto_delete_timer_changed: _gramio_contexts.MessageAutoDeleteTimerChangedContext<AnyBot>;
746
- message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
747
- channel_post: _gramio_contexts.MessageContext<AnyBot>;
748
- edited_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
749
- edited_channel_post: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
750
- business_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
751
- edited_business_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
752
- deleted_business_messages: _gramio_contexts.BusinessMessagesDeletedContext<AnyBot>;
753
- business_connection: _gramio_contexts.BusinessConnectionContext<AnyBot>;
754
- migrate_from_chat_id: _gramio_contexts.MigrateFromChatIdContext<AnyBot>;
755
- migrate_to_chat_id: _gramio_contexts.MigrateToChatIdContext<AnyBot>;
756
- new_chat_members: _gramio_contexts.NewChatMembersContext<AnyBot>;
757
- new_chat_photo: _gramio_contexts.NewChatPhotoContext<AnyBot>;
758
- new_chat_title: _gramio_contexts.NewChatTitleContext<AnyBot>;
759
- passport_data: _gramio_contexts.PassportDataContext<AnyBot>;
760
- pinned_message: _gramio_contexts.PinnedMessageContext<AnyBot>;
761
- poll_answer: _gramio_contexts.PollAnswerContext<AnyBot>;
762
- poll: _gramio_contexts.PollContext<AnyBot>;
763
- pre_checkout_query: _gramio_contexts.PreCheckoutQueryContext<AnyBot>;
764
- proximity_alert_triggered: _gramio_contexts.ProximityAlertTriggeredContext<AnyBot>;
765
- write_access_allowed: _gramio_contexts.WriteAccessAllowedContext<AnyBot>;
766
- boost_added: _gramio_contexts.BoostAddedContext<AnyBot>;
767
- chat_background_set: _gramio_contexts.ChatBackgroundSetContext<AnyBot>;
768
- checklist_tasks_done: _gramio_contexts.ChecklistTasksDoneContext<AnyBot>;
769
- checklist_tasks_added: _gramio_contexts.ChecklistTasksAddedContext<AnyBot>;
770
- direct_message_price_changed: _gramio_contexts.DirectMessagePriceChangedContext<AnyBot>;
771
- suggested_post_approved: _gramio_contexts.SuggestedPostApprovedContext<AnyBot>;
772
- suggested_post_approval_failed: _gramio_contexts.SuggestedPostApprovalFailedContext<AnyBot>;
773
- suggested_post_declined: _gramio_contexts.SuggestedPostDeclinedContext<AnyBot>;
774
- suggested_post_paid: _gramio_contexts.SuggestedPostPaidContext<AnyBot>;
775
- suggested_post_refunded: _gramio_contexts.SuggestedPostRefundedContext<AnyBot>;
776
- forum_topic_created: _gramio_contexts.ForumTopicCreatedContext<AnyBot>;
777
- forum_topic_edited: _gramio_contexts.ForumTopicEditedContext<AnyBot>;
778
- forum_topic_closed: _gramio_contexts.ForumTopicClosedContext<AnyBot>;
779
- forum_topic_reopened: _gramio_contexts.ForumTopicReopenedContext<AnyBot>;
780
- general_forum_topic_hidden: _gramio_contexts.GeneralForumTopicHiddenContext<AnyBot>;
781
- general_forum_topic_unhidden: _gramio_contexts.GeneralForumTopicUnhiddenContext<AnyBot>;
782
- shipping_query: _gramio_contexts.ShippingQueryContext<AnyBot>;
783
- successful_payment: _gramio_contexts.SuccessfulPaymentContext<AnyBot>;
784
- refunded_payment: _gramio_contexts.RefundedPaymentContext<AnyBot>;
785
- users_shared: _gramio_contexts.UsersSharedContext<AnyBot>;
786
- chat_shared: _gramio_contexts.ChatSharedContext<AnyBot>;
787
- gift: _gramio_contexts.GiftContext<AnyBot>;
788
- gift_upgrade_sent: _gramio_contexts.GiftUpgradeSentContext<AnyBot>;
789
- unique_gift: _gramio_contexts.UniqueGiftContext<AnyBot>;
790
- chat_owner_left: _gramio_contexts.ChatOwnerLeftContext<AnyBot>;
791
- chat_owner_changed: _gramio_contexts.ChatOwnerChangedContext<AnyBot>;
792
- paid_message_price_changed: _gramio_contexts.PaidMessagePriceChangedContext<AnyBot>;
793
- video_chat_ended: _gramio_contexts.VideoChatEndedContext<AnyBot>;
794
- video_chat_participants_invited: _gramio_contexts.VideoChatParticipantsInvitedContext<AnyBot>;
795
- video_chat_scheduled: _gramio_contexts.VideoChatScheduledContext<AnyBot>;
796
- video_chat_started: _gramio_contexts.VideoChatStartedContext<AnyBot>;
797
- web_app_data: _gramio_contexts.WebAppDataContext<AnyBot>;
798
- service_message: _gramio_contexts.MessageContext<AnyBot>;
799
- message_reaction: _gramio_contexts.MessageReactionContext<AnyBot>;
800
- message_reaction_count: _gramio_contexts.MessageReactionCountContext<AnyBot>;
801
- chat_boost: _gramio_contexts.ChatBoostContext<AnyBot>;
802
- removed_chat_boost: _gramio_contexts.RemovedChatBoostContext<AnyBot>;
803
- giveaway_created: _gramio_contexts.GiveawayCreatedContext<AnyBot>;
804
- giveaway_completed: _gramio_contexts.GiveawayCompletedContext<AnyBot>;
805
- giveaway_winners: _gramio_contexts.GiveawayWinnersContext<AnyBot>;
806
- purchased_paid_media: _gramio_contexts.PaidMediaPurchasedContext<AnyBot>;
807
- }, Context<AnyBot>, Context<AnyBot>, {}, {}, /*elided*/ any> & /*elided*/ any;
808
- callbackQuery(trigger: _gramio_callback_data.CallbackData | string | RegExp, handler: (context: CallbackQueryShorthandContext<AnyBot, any>) => unknown): EventComposer<Context<AnyBot>, {
809
- callback_query: _gramio_contexts.CallbackQueryContext<AnyBot>;
810
- chat_join_request: _gramio_contexts.ChatJoinRequestContext<AnyBot>;
811
- chat_member: _gramio_contexts.ChatMemberContext<AnyBot>;
812
- my_chat_member: _gramio_contexts.ChatMemberContext<AnyBot>;
813
- chosen_inline_result: _gramio_contexts.ChosenInlineResultContext<AnyBot>;
814
- delete_chat_photo: _gramio_contexts.DeleteChatPhotoContext<AnyBot>;
815
- group_chat_created: _gramio_contexts.GroupChatCreatedContext<AnyBot>;
816
- inline_query: _gramio_contexts.InlineQueryContext<AnyBot>;
817
- invoice: _gramio_contexts.InvoiceContext<AnyBot>;
818
- left_chat_member: _gramio_contexts.LeftChatMemberContext<AnyBot>;
819
- location: _gramio_contexts.LocationContext<AnyBot>;
820
- message_auto_delete_timer_changed: _gramio_contexts.MessageAutoDeleteTimerChangedContext<AnyBot>;
821
- message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
822
- channel_post: _gramio_contexts.MessageContext<AnyBot>;
823
- edited_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
824
- edited_channel_post: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
825
- business_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
826
- edited_business_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
827
- deleted_business_messages: _gramio_contexts.BusinessMessagesDeletedContext<AnyBot>;
828
- business_connection: _gramio_contexts.BusinessConnectionContext<AnyBot>;
829
- migrate_from_chat_id: _gramio_contexts.MigrateFromChatIdContext<AnyBot>;
830
- migrate_to_chat_id: _gramio_contexts.MigrateToChatIdContext<AnyBot>;
831
- new_chat_members: _gramio_contexts.NewChatMembersContext<AnyBot>;
832
- new_chat_photo: _gramio_contexts.NewChatPhotoContext<AnyBot>;
833
- new_chat_title: _gramio_contexts.NewChatTitleContext<AnyBot>;
834
- passport_data: _gramio_contexts.PassportDataContext<AnyBot>;
835
- pinned_message: _gramio_contexts.PinnedMessageContext<AnyBot>;
836
- poll_answer: _gramio_contexts.PollAnswerContext<AnyBot>;
837
- poll: _gramio_contexts.PollContext<AnyBot>;
838
- pre_checkout_query: _gramio_contexts.PreCheckoutQueryContext<AnyBot>;
839
- proximity_alert_triggered: _gramio_contexts.ProximityAlertTriggeredContext<AnyBot>;
840
- write_access_allowed: _gramio_contexts.WriteAccessAllowedContext<AnyBot>;
841
- boost_added: _gramio_contexts.BoostAddedContext<AnyBot>;
842
- chat_background_set: _gramio_contexts.ChatBackgroundSetContext<AnyBot>;
843
- checklist_tasks_done: _gramio_contexts.ChecklistTasksDoneContext<AnyBot>;
844
- checklist_tasks_added: _gramio_contexts.ChecklistTasksAddedContext<AnyBot>;
845
- direct_message_price_changed: _gramio_contexts.DirectMessagePriceChangedContext<AnyBot>;
846
- suggested_post_approved: _gramio_contexts.SuggestedPostApprovedContext<AnyBot>;
847
- suggested_post_approval_failed: _gramio_contexts.SuggestedPostApprovalFailedContext<AnyBot>;
848
- suggested_post_declined: _gramio_contexts.SuggestedPostDeclinedContext<AnyBot>;
849
- suggested_post_paid: _gramio_contexts.SuggestedPostPaidContext<AnyBot>;
850
- suggested_post_refunded: _gramio_contexts.SuggestedPostRefundedContext<AnyBot>;
851
- forum_topic_created: _gramio_contexts.ForumTopicCreatedContext<AnyBot>;
852
- forum_topic_edited: _gramio_contexts.ForumTopicEditedContext<AnyBot>;
853
- forum_topic_closed: _gramio_contexts.ForumTopicClosedContext<AnyBot>;
854
- forum_topic_reopened: _gramio_contexts.ForumTopicReopenedContext<AnyBot>;
855
- general_forum_topic_hidden: _gramio_contexts.GeneralForumTopicHiddenContext<AnyBot>;
856
- general_forum_topic_unhidden: _gramio_contexts.GeneralForumTopicUnhiddenContext<AnyBot>;
857
- shipping_query: _gramio_contexts.ShippingQueryContext<AnyBot>;
858
- successful_payment: _gramio_contexts.SuccessfulPaymentContext<AnyBot>;
859
- refunded_payment: _gramio_contexts.RefundedPaymentContext<AnyBot>;
860
- users_shared: _gramio_contexts.UsersSharedContext<AnyBot>;
861
- chat_shared: _gramio_contexts.ChatSharedContext<AnyBot>;
862
- gift: _gramio_contexts.GiftContext<AnyBot>;
863
- gift_upgrade_sent: _gramio_contexts.GiftUpgradeSentContext<AnyBot>;
864
- unique_gift: _gramio_contexts.UniqueGiftContext<AnyBot>;
865
- chat_owner_left: _gramio_contexts.ChatOwnerLeftContext<AnyBot>;
866
- chat_owner_changed: _gramio_contexts.ChatOwnerChangedContext<AnyBot>;
867
- paid_message_price_changed: _gramio_contexts.PaidMessagePriceChangedContext<AnyBot>;
868
- video_chat_ended: _gramio_contexts.VideoChatEndedContext<AnyBot>;
869
- video_chat_participants_invited: _gramio_contexts.VideoChatParticipantsInvitedContext<AnyBot>;
870
- video_chat_scheduled: _gramio_contexts.VideoChatScheduledContext<AnyBot>;
871
- video_chat_started: _gramio_contexts.VideoChatStartedContext<AnyBot>;
872
- web_app_data: _gramio_contexts.WebAppDataContext<AnyBot>;
873
- service_message: _gramio_contexts.MessageContext<AnyBot>;
874
- message_reaction: _gramio_contexts.MessageReactionContext<AnyBot>;
875
- message_reaction_count: _gramio_contexts.MessageReactionCountContext<AnyBot>;
876
- chat_boost: _gramio_contexts.ChatBoostContext<AnyBot>;
877
- removed_chat_boost: _gramio_contexts.RemovedChatBoostContext<AnyBot>;
878
- giveaway_created: _gramio_contexts.GiveawayCreatedContext<AnyBot>;
879
- giveaway_completed: _gramio_contexts.GiveawayCompletedContext<AnyBot>;
880
- giveaway_winners: _gramio_contexts.GiveawayWinnersContext<AnyBot>;
881
- purchased_paid_media: _gramio_contexts.PaidMediaPurchasedContext<AnyBot>;
882
- }, Context<AnyBot>, Context<AnyBot>, {}, {}, /*elided*/ any> & /*elided*/ any;
883
- chosenInlineResult(trigger: RegExp | string | ((context: _gramio_contexts.ChosenInlineResultContext<AnyBot>) => boolean), handler: (context: _gramio_contexts.ChosenInlineResultContext<AnyBot> & {
278
+ } & _gramio_composer.EventContextOf<TThis, "message">>, macroOptions?: Record<string, unknown>): TThis;
279
+ }, {}> & {
280
+ reaction<TThis extends _gramio_composer.ComposerLike<TThis> & {
281
+ "~": {
282
+ macros: MacroDefinitions;
283
+ Derives?: Record<string, object>;
284
+ };
285
+ chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
286
+ }>(this: TThis, trigger: MaybeArray<_gramio_types.TelegramReactionTypeEmojiEmoji>, handler: (context: _gramio_contexts.MessageReactionContext<AnyBot> & _gramio_composer.EventContextOf<TThis, "message_reaction">) => unknown, macroOptions?: Record<string, unknown>): TThis;
287
+ callbackQuery<TThis extends _gramio_composer.ComposerLike<TThis> & {
288
+ "~": {
289
+ macros: MacroDefinitions;
290
+ Derives?: Record<string, object>;
291
+ };
292
+ chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
293
+ }, Trigger extends _gramio_callback_data.CallbackData | string | RegExp>(this: TThis, trigger: Trigger, handler: (context: _gramio_contexts.CallbackQueryContext<AnyBot> & {
294
+ queryData: Trigger extends _gramio_callback_data.CallbackData ? ReturnType<Trigger["unpack"]> : Trigger extends RegExp ? RegExpMatchArray : never;
295
+ } & _gramio_composer.EventContextOf<TThis, "callback_query">) => unknown, macroOptions?: Record<string, unknown>): TThis;
296
+ chosenInlineResult<TThis extends _gramio_composer.ComposerLike<TThis> & {
297
+ "~": {
298
+ macros: MacroDefinitions;
299
+ Derives?: Record<string, object>;
300
+ };
301
+ chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
302
+ }>(this: TThis, trigger: RegExp | string | ((context: _gramio_contexts.ChosenInlineResultContext<AnyBot>) => boolean), handler: (context: _gramio_contexts.ChosenInlineResultContext<AnyBot> & {
884
303
  args: RegExpMatchArray | null;
885
- }) => unknown): EventComposer<Context<AnyBot>, {
886
- callback_query: _gramio_contexts.CallbackQueryContext<AnyBot>;
887
- chat_join_request: _gramio_contexts.ChatJoinRequestContext<AnyBot>;
888
- chat_member: _gramio_contexts.ChatMemberContext<AnyBot>;
889
- my_chat_member: _gramio_contexts.ChatMemberContext<AnyBot>;
890
- chosen_inline_result: _gramio_contexts.ChosenInlineResultContext<AnyBot>;
891
- delete_chat_photo: _gramio_contexts.DeleteChatPhotoContext<AnyBot>;
892
- group_chat_created: _gramio_contexts.GroupChatCreatedContext<AnyBot>;
893
- inline_query: _gramio_contexts.InlineQueryContext<AnyBot>;
894
- invoice: _gramio_contexts.InvoiceContext<AnyBot>;
895
- left_chat_member: _gramio_contexts.LeftChatMemberContext<AnyBot>;
896
- location: _gramio_contexts.LocationContext<AnyBot>;
897
- message_auto_delete_timer_changed: _gramio_contexts.MessageAutoDeleteTimerChangedContext<AnyBot>;
898
- message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
899
- channel_post: _gramio_contexts.MessageContext<AnyBot>;
900
- edited_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
901
- edited_channel_post: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
902
- business_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
903
- edited_business_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
904
- deleted_business_messages: _gramio_contexts.BusinessMessagesDeletedContext<AnyBot>;
905
- business_connection: _gramio_contexts.BusinessConnectionContext<AnyBot>;
906
- migrate_from_chat_id: _gramio_contexts.MigrateFromChatIdContext<AnyBot>;
907
- migrate_to_chat_id: _gramio_contexts.MigrateToChatIdContext<AnyBot>;
908
- new_chat_members: _gramio_contexts.NewChatMembersContext<AnyBot>;
909
- new_chat_photo: _gramio_contexts.NewChatPhotoContext<AnyBot>;
910
- new_chat_title: _gramio_contexts.NewChatTitleContext<AnyBot>;
911
- passport_data: _gramio_contexts.PassportDataContext<AnyBot>;
912
- pinned_message: _gramio_contexts.PinnedMessageContext<AnyBot>;
913
- poll_answer: _gramio_contexts.PollAnswerContext<AnyBot>;
914
- poll: _gramio_contexts.PollContext<AnyBot>;
915
- pre_checkout_query: _gramio_contexts.PreCheckoutQueryContext<AnyBot>;
916
- proximity_alert_triggered: _gramio_contexts.ProximityAlertTriggeredContext<AnyBot>;
917
- write_access_allowed: _gramio_contexts.WriteAccessAllowedContext<AnyBot>;
918
- boost_added: _gramio_contexts.BoostAddedContext<AnyBot>;
919
- chat_background_set: _gramio_contexts.ChatBackgroundSetContext<AnyBot>;
920
- checklist_tasks_done: _gramio_contexts.ChecklistTasksDoneContext<AnyBot>;
921
- checklist_tasks_added: _gramio_contexts.ChecklistTasksAddedContext<AnyBot>;
922
- direct_message_price_changed: _gramio_contexts.DirectMessagePriceChangedContext<AnyBot>;
923
- suggested_post_approved: _gramio_contexts.SuggestedPostApprovedContext<AnyBot>;
924
- suggested_post_approval_failed: _gramio_contexts.SuggestedPostApprovalFailedContext<AnyBot>;
925
- suggested_post_declined: _gramio_contexts.SuggestedPostDeclinedContext<AnyBot>;
926
- suggested_post_paid: _gramio_contexts.SuggestedPostPaidContext<AnyBot>;
927
- suggested_post_refunded: _gramio_contexts.SuggestedPostRefundedContext<AnyBot>;
928
- forum_topic_created: _gramio_contexts.ForumTopicCreatedContext<AnyBot>;
929
- forum_topic_edited: _gramio_contexts.ForumTopicEditedContext<AnyBot>;
930
- forum_topic_closed: _gramio_contexts.ForumTopicClosedContext<AnyBot>;
931
- forum_topic_reopened: _gramio_contexts.ForumTopicReopenedContext<AnyBot>;
932
- general_forum_topic_hidden: _gramio_contexts.GeneralForumTopicHiddenContext<AnyBot>;
933
- general_forum_topic_unhidden: _gramio_contexts.GeneralForumTopicUnhiddenContext<AnyBot>;
934
- shipping_query: _gramio_contexts.ShippingQueryContext<AnyBot>;
935
- successful_payment: _gramio_contexts.SuccessfulPaymentContext<AnyBot>;
936
- refunded_payment: _gramio_contexts.RefundedPaymentContext<AnyBot>;
937
- users_shared: _gramio_contexts.UsersSharedContext<AnyBot>;
938
- chat_shared: _gramio_contexts.ChatSharedContext<AnyBot>;
939
- gift: _gramio_contexts.GiftContext<AnyBot>;
940
- gift_upgrade_sent: _gramio_contexts.GiftUpgradeSentContext<AnyBot>;
941
- unique_gift: _gramio_contexts.UniqueGiftContext<AnyBot>;
942
- chat_owner_left: _gramio_contexts.ChatOwnerLeftContext<AnyBot>;
943
- chat_owner_changed: _gramio_contexts.ChatOwnerChangedContext<AnyBot>;
944
- paid_message_price_changed: _gramio_contexts.PaidMessagePriceChangedContext<AnyBot>;
945
- video_chat_ended: _gramio_contexts.VideoChatEndedContext<AnyBot>;
946
- video_chat_participants_invited: _gramio_contexts.VideoChatParticipantsInvitedContext<AnyBot>;
947
- video_chat_scheduled: _gramio_contexts.VideoChatScheduledContext<AnyBot>;
948
- video_chat_started: _gramio_contexts.VideoChatStartedContext<AnyBot>;
949
- web_app_data: _gramio_contexts.WebAppDataContext<AnyBot>;
950
- service_message: _gramio_contexts.MessageContext<AnyBot>;
951
- message_reaction: _gramio_contexts.MessageReactionContext<AnyBot>;
952
- message_reaction_count: _gramio_contexts.MessageReactionCountContext<AnyBot>;
953
- chat_boost: _gramio_contexts.ChatBoostContext<AnyBot>;
954
- removed_chat_boost: _gramio_contexts.RemovedChatBoostContext<AnyBot>;
955
- giveaway_created: _gramio_contexts.GiveawayCreatedContext<AnyBot>;
956
- giveaway_completed: _gramio_contexts.GiveawayCompletedContext<AnyBot>;
957
- giveaway_winners: _gramio_contexts.GiveawayWinnersContext<AnyBot>;
958
- purchased_paid_media: _gramio_contexts.PaidMediaPurchasedContext<AnyBot>;
959
- }, Context<AnyBot>, Context<AnyBot>, {}, {}, /*elided*/ any> & /*elided*/ any;
960
- inlineQuery(trigger: RegExp | string | ((context: _gramio_contexts.InlineQueryContext<AnyBot>) => boolean), handler: (context: _gramio_contexts.InlineQueryContext<AnyBot> & {
304
+ } & _gramio_composer.EventContextOf<TThis, "chosen_inline_result">) => unknown, macroOptions?: Record<string, unknown>): TThis;
305
+ inlineQuery<TThis extends _gramio_composer.ComposerLike<TThis> & {
306
+ "~": {
307
+ macros: MacroDefinitions;
308
+ Derives?: Record<string, object>;
309
+ };
310
+ chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
311
+ }>(this: TThis, trigger: RegExp | string | ((context: _gramio_contexts.InlineQueryContext<AnyBot>) => boolean), handler: (context: _gramio_contexts.InlineQueryContext<AnyBot> & {
961
312
  args: RegExpMatchArray | null;
962
- }) => unknown, options?: {
313
+ } & _gramio_composer.EventContextOf<TThis, "inline_query">) => unknown, options?: {
963
314
  onResult?: (context: _gramio_contexts.ChosenInlineResultContext<AnyBot> & {
964
315
  args: RegExpMatchArray | null;
965
- }) => unknown;
966
- }): EventComposer<Context<AnyBot>, {
967
- callback_query: _gramio_contexts.CallbackQueryContext<AnyBot>;
968
- chat_join_request: _gramio_contexts.ChatJoinRequestContext<AnyBot>;
969
- chat_member: _gramio_contexts.ChatMemberContext<AnyBot>;
970
- my_chat_member: _gramio_contexts.ChatMemberContext<AnyBot>;
971
- chosen_inline_result: _gramio_contexts.ChosenInlineResultContext<AnyBot>;
972
- delete_chat_photo: _gramio_contexts.DeleteChatPhotoContext<AnyBot>;
973
- group_chat_created: _gramio_contexts.GroupChatCreatedContext<AnyBot>;
974
- inline_query: _gramio_contexts.InlineQueryContext<AnyBot>;
975
- invoice: _gramio_contexts.InvoiceContext<AnyBot>;
976
- left_chat_member: _gramio_contexts.LeftChatMemberContext<AnyBot>;
977
- location: _gramio_contexts.LocationContext<AnyBot>;
978
- message_auto_delete_timer_changed: _gramio_contexts.MessageAutoDeleteTimerChangedContext<AnyBot>;
979
- message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
980
- channel_post: _gramio_contexts.MessageContext<AnyBot>;
981
- edited_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
982
- edited_channel_post: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
983
- business_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
984
- edited_business_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
985
- deleted_business_messages: _gramio_contexts.BusinessMessagesDeletedContext<AnyBot>;
986
- business_connection: _gramio_contexts.BusinessConnectionContext<AnyBot>;
987
- migrate_from_chat_id: _gramio_contexts.MigrateFromChatIdContext<AnyBot>;
988
- migrate_to_chat_id: _gramio_contexts.MigrateToChatIdContext<AnyBot>;
989
- new_chat_members: _gramio_contexts.NewChatMembersContext<AnyBot>;
990
- new_chat_photo: _gramio_contexts.NewChatPhotoContext<AnyBot>;
991
- new_chat_title: _gramio_contexts.NewChatTitleContext<AnyBot>;
992
- passport_data: _gramio_contexts.PassportDataContext<AnyBot>;
993
- pinned_message: _gramio_contexts.PinnedMessageContext<AnyBot>;
994
- poll_answer: _gramio_contexts.PollAnswerContext<AnyBot>;
995
- poll: _gramio_contexts.PollContext<AnyBot>;
996
- pre_checkout_query: _gramio_contexts.PreCheckoutQueryContext<AnyBot>;
997
- proximity_alert_triggered: _gramio_contexts.ProximityAlertTriggeredContext<AnyBot>;
998
- write_access_allowed: _gramio_contexts.WriteAccessAllowedContext<AnyBot>;
999
- boost_added: _gramio_contexts.BoostAddedContext<AnyBot>;
1000
- chat_background_set: _gramio_contexts.ChatBackgroundSetContext<AnyBot>;
1001
- checklist_tasks_done: _gramio_contexts.ChecklistTasksDoneContext<AnyBot>;
1002
- checklist_tasks_added: _gramio_contexts.ChecklistTasksAddedContext<AnyBot>;
1003
- direct_message_price_changed: _gramio_contexts.DirectMessagePriceChangedContext<AnyBot>;
1004
- suggested_post_approved: _gramio_contexts.SuggestedPostApprovedContext<AnyBot>;
1005
- suggested_post_approval_failed: _gramio_contexts.SuggestedPostApprovalFailedContext<AnyBot>;
1006
- suggested_post_declined: _gramio_contexts.SuggestedPostDeclinedContext<AnyBot>;
1007
- suggested_post_paid: _gramio_contexts.SuggestedPostPaidContext<AnyBot>;
1008
- suggested_post_refunded: _gramio_contexts.SuggestedPostRefundedContext<AnyBot>;
1009
- forum_topic_created: _gramio_contexts.ForumTopicCreatedContext<AnyBot>;
1010
- forum_topic_edited: _gramio_contexts.ForumTopicEditedContext<AnyBot>;
1011
- forum_topic_closed: _gramio_contexts.ForumTopicClosedContext<AnyBot>;
1012
- forum_topic_reopened: _gramio_contexts.ForumTopicReopenedContext<AnyBot>;
1013
- general_forum_topic_hidden: _gramio_contexts.GeneralForumTopicHiddenContext<AnyBot>;
1014
- general_forum_topic_unhidden: _gramio_contexts.GeneralForumTopicUnhiddenContext<AnyBot>;
1015
- shipping_query: _gramio_contexts.ShippingQueryContext<AnyBot>;
1016
- successful_payment: _gramio_contexts.SuccessfulPaymentContext<AnyBot>;
1017
- refunded_payment: _gramio_contexts.RefundedPaymentContext<AnyBot>;
1018
- users_shared: _gramio_contexts.UsersSharedContext<AnyBot>;
1019
- chat_shared: _gramio_contexts.ChatSharedContext<AnyBot>;
1020
- gift: _gramio_contexts.GiftContext<AnyBot>;
1021
- gift_upgrade_sent: _gramio_contexts.GiftUpgradeSentContext<AnyBot>;
1022
- unique_gift: _gramio_contexts.UniqueGiftContext<AnyBot>;
1023
- chat_owner_left: _gramio_contexts.ChatOwnerLeftContext<AnyBot>;
1024
- chat_owner_changed: _gramio_contexts.ChatOwnerChangedContext<AnyBot>;
1025
- paid_message_price_changed: _gramio_contexts.PaidMessagePriceChangedContext<AnyBot>;
1026
- video_chat_ended: _gramio_contexts.VideoChatEndedContext<AnyBot>;
1027
- video_chat_participants_invited: _gramio_contexts.VideoChatParticipantsInvitedContext<AnyBot>;
1028
- video_chat_scheduled: _gramio_contexts.VideoChatScheduledContext<AnyBot>;
1029
- video_chat_started: _gramio_contexts.VideoChatStartedContext<AnyBot>;
1030
- web_app_data: _gramio_contexts.WebAppDataContext<AnyBot>;
1031
- service_message: _gramio_contexts.MessageContext<AnyBot>;
1032
- message_reaction: _gramio_contexts.MessageReactionContext<AnyBot>;
1033
- message_reaction_count: _gramio_contexts.MessageReactionCountContext<AnyBot>;
1034
- chat_boost: _gramio_contexts.ChatBoostContext<AnyBot>;
1035
- removed_chat_boost: _gramio_contexts.RemovedChatBoostContext<AnyBot>;
1036
- giveaway_created: _gramio_contexts.GiveawayCreatedContext<AnyBot>;
1037
- giveaway_completed: _gramio_contexts.GiveawayCompletedContext<AnyBot>;
1038
- giveaway_winners: _gramio_contexts.GiveawayWinnersContext<AnyBot>;
1039
- purchased_paid_media: _gramio_contexts.PaidMediaPurchasedContext<AnyBot>;
1040
- }, Context<AnyBot>, Context<AnyBot>, {}, {}, /*elided*/ any> & /*elided*/ any;
1041
- hears(trigger: RegExp | MaybeArray<string> | ((context: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) => boolean), handler: (context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
316
+ } & _gramio_composer.EventContextOf<TThis, "chosen_inline_result">) => unknown;
317
+ } & Record<string, unknown>): TThis;
318
+ hears<TThis extends _gramio_composer.ComposerLike<TThis> & {
319
+ "~": {
320
+ macros: MacroDefinitions;
321
+ Derives?: Record<string, object>;
322
+ };
323
+ chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
324
+ }>(this: TThis, trigger: RegExp | MaybeArray<string> | ((context: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) => boolean), handler: (context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
1042
325
  args: RegExpMatchArray | null;
1043
- }) => unknown): EventComposer<Context<AnyBot>, {
1044
- callback_query: _gramio_contexts.CallbackQueryContext<AnyBot>;
1045
- chat_join_request: _gramio_contexts.ChatJoinRequestContext<AnyBot>;
1046
- chat_member: _gramio_contexts.ChatMemberContext<AnyBot>;
1047
- my_chat_member: _gramio_contexts.ChatMemberContext<AnyBot>;
1048
- chosen_inline_result: _gramio_contexts.ChosenInlineResultContext<AnyBot>;
1049
- delete_chat_photo: _gramio_contexts.DeleteChatPhotoContext<AnyBot>;
1050
- group_chat_created: _gramio_contexts.GroupChatCreatedContext<AnyBot>;
1051
- inline_query: _gramio_contexts.InlineQueryContext<AnyBot>;
1052
- invoice: _gramio_contexts.InvoiceContext<AnyBot>;
1053
- left_chat_member: _gramio_contexts.LeftChatMemberContext<AnyBot>;
1054
- location: _gramio_contexts.LocationContext<AnyBot>;
1055
- message_auto_delete_timer_changed: _gramio_contexts.MessageAutoDeleteTimerChangedContext<AnyBot>;
1056
- message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
1057
- channel_post: _gramio_contexts.MessageContext<AnyBot>;
1058
- edited_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
1059
- edited_channel_post: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
1060
- business_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
1061
- edited_business_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
1062
- deleted_business_messages: _gramio_contexts.BusinessMessagesDeletedContext<AnyBot>;
1063
- business_connection: _gramio_contexts.BusinessConnectionContext<AnyBot>;
1064
- migrate_from_chat_id: _gramio_contexts.MigrateFromChatIdContext<AnyBot>;
1065
- migrate_to_chat_id: _gramio_contexts.MigrateToChatIdContext<AnyBot>;
1066
- new_chat_members: _gramio_contexts.NewChatMembersContext<AnyBot>;
1067
- new_chat_photo: _gramio_contexts.NewChatPhotoContext<AnyBot>;
1068
- new_chat_title: _gramio_contexts.NewChatTitleContext<AnyBot>;
1069
- passport_data: _gramio_contexts.PassportDataContext<AnyBot>;
1070
- pinned_message: _gramio_contexts.PinnedMessageContext<AnyBot>;
1071
- poll_answer: _gramio_contexts.PollAnswerContext<AnyBot>;
1072
- poll: _gramio_contexts.PollContext<AnyBot>;
1073
- pre_checkout_query: _gramio_contexts.PreCheckoutQueryContext<AnyBot>;
1074
- proximity_alert_triggered: _gramio_contexts.ProximityAlertTriggeredContext<AnyBot>;
1075
- write_access_allowed: _gramio_contexts.WriteAccessAllowedContext<AnyBot>;
1076
- boost_added: _gramio_contexts.BoostAddedContext<AnyBot>;
1077
- chat_background_set: _gramio_contexts.ChatBackgroundSetContext<AnyBot>;
1078
- checklist_tasks_done: _gramio_contexts.ChecklistTasksDoneContext<AnyBot>;
1079
- checklist_tasks_added: _gramio_contexts.ChecklistTasksAddedContext<AnyBot>;
1080
- direct_message_price_changed: _gramio_contexts.DirectMessagePriceChangedContext<AnyBot>;
1081
- suggested_post_approved: _gramio_contexts.SuggestedPostApprovedContext<AnyBot>;
1082
- suggested_post_approval_failed: _gramio_contexts.SuggestedPostApprovalFailedContext<AnyBot>;
1083
- suggested_post_declined: _gramio_contexts.SuggestedPostDeclinedContext<AnyBot>;
1084
- suggested_post_paid: _gramio_contexts.SuggestedPostPaidContext<AnyBot>;
1085
- suggested_post_refunded: _gramio_contexts.SuggestedPostRefundedContext<AnyBot>;
1086
- forum_topic_created: _gramio_contexts.ForumTopicCreatedContext<AnyBot>;
1087
- forum_topic_edited: _gramio_contexts.ForumTopicEditedContext<AnyBot>;
1088
- forum_topic_closed: _gramio_contexts.ForumTopicClosedContext<AnyBot>;
1089
- forum_topic_reopened: _gramio_contexts.ForumTopicReopenedContext<AnyBot>;
1090
- general_forum_topic_hidden: _gramio_contexts.GeneralForumTopicHiddenContext<AnyBot>;
1091
- general_forum_topic_unhidden: _gramio_contexts.GeneralForumTopicUnhiddenContext<AnyBot>;
1092
- shipping_query: _gramio_contexts.ShippingQueryContext<AnyBot>;
1093
- successful_payment: _gramio_contexts.SuccessfulPaymentContext<AnyBot>;
1094
- refunded_payment: _gramio_contexts.RefundedPaymentContext<AnyBot>;
1095
- users_shared: _gramio_contexts.UsersSharedContext<AnyBot>;
1096
- chat_shared: _gramio_contexts.ChatSharedContext<AnyBot>;
1097
- gift: _gramio_contexts.GiftContext<AnyBot>;
1098
- gift_upgrade_sent: _gramio_contexts.GiftUpgradeSentContext<AnyBot>;
1099
- unique_gift: _gramio_contexts.UniqueGiftContext<AnyBot>;
1100
- chat_owner_left: _gramio_contexts.ChatOwnerLeftContext<AnyBot>;
1101
- chat_owner_changed: _gramio_contexts.ChatOwnerChangedContext<AnyBot>;
1102
- paid_message_price_changed: _gramio_contexts.PaidMessagePriceChangedContext<AnyBot>;
1103
- video_chat_ended: _gramio_contexts.VideoChatEndedContext<AnyBot>;
1104
- video_chat_participants_invited: _gramio_contexts.VideoChatParticipantsInvitedContext<AnyBot>;
1105
- video_chat_scheduled: _gramio_contexts.VideoChatScheduledContext<AnyBot>;
1106
- video_chat_started: _gramio_contexts.VideoChatStartedContext<AnyBot>;
1107
- web_app_data: _gramio_contexts.WebAppDataContext<AnyBot>;
1108
- service_message: _gramio_contexts.MessageContext<AnyBot>;
1109
- message_reaction: _gramio_contexts.MessageReactionContext<AnyBot>;
1110
- message_reaction_count: _gramio_contexts.MessageReactionCountContext<AnyBot>;
1111
- chat_boost: _gramio_contexts.ChatBoostContext<AnyBot>;
1112
- removed_chat_boost: _gramio_contexts.RemovedChatBoostContext<AnyBot>;
1113
- giveaway_created: _gramio_contexts.GiveawayCreatedContext<AnyBot>;
1114
- giveaway_completed: _gramio_contexts.GiveawayCompletedContext<AnyBot>;
1115
- giveaway_winners: _gramio_contexts.GiveawayWinnersContext<AnyBot>;
1116
- purchased_paid_media: _gramio_contexts.PaidMediaPurchasedContext<AnyBot>;
1117
- }, Context<AnyBot>, Context<AnyBot>, {}, {}, /*elided*/ any> & /*elided*/ any;
1118
- command(command: MaybeArray<string>, handler: (context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
326
+ } & _gramio_composer.EventContextOf<TThis, "message">) => unknown, macroOptions?: Record<string, unknown>): TThis;
327
+ command<TThis extends _gramio_composer.ComposerLike<TThis> & {
328
+ "~": {
329
+ macros: MacroDefinitions;
330
+ Derives?: Record<string, object>;
331
+ };
332
+ chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
333
+ }>(this: TThis, command: MaybeArray<string>, handler: (context: (_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
1119
334
  args: string | null;
1120
- }) => unknown): EventComposer<Context<AnyBot>, {
1121
- callback_query: _gramio_contexts.CallbackQueryContext<AnyBot>;
1122
- chat_join_request: _gramio_contexts.ChatJoinRequestContext<AnyBot>;
1123
- chat_member: _gramio_contexts.ChatMemberContext<AnyBot>;
1124
- my_chat_member: _gramio_contexts.ChatMemberContext<AnyBot>;
1125
- chosen_inline_result: _gramio_contexts.ChosenInlineResultContext<AnyBot>;
1126
- delete_chat_photo: _gramio_contexts.DeleteChatPhotoContext<AnyBot>;
1127
- group_chat_created: _gramio_contexts.GroupChatCreatedContext<AnyBot>;
1128
- inline_query: _gramio_contexts.InlineQueryContext<AnyBot>;
1129
- invoice: _gramio_contexts.InvoiceContext<AnyBot>;
1130
- left_chat_member: _gramio_contexts.LeftChatMemberContext<AnyBot>;
1131
- location: _gramio_contexts.LocationContext<AnyBot>;
1132
- message_auto_delete_timer_changed: _gramio_contexts.MessageAutoDeleteTimerChangedContext<AnyBot>;
1133
- message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
1134
- channel_post: _gramio_contexts.MessageContext<AnyBot>;
1135
- edited_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
1136
- edited_channel_post: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
1137
- business_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
1138
- edited_business_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
1139
- deleted_business_messages: _gramio_contexts.BusinessMessagesDeletedContext<AnyBot>;
1140
- business_connection: _gramio_contexts.BusinessConnectionContext<AnyBot>;
1141
- migrate_from_chat_id: _gramio_contexts.MigrateFromChatIdContext<AnyBot>;
1142
- migrate_to_chat_id: _gramio_contexts.MigrateToChatIdContext<AnyBot>;
1143
- new_chat_members: _gramio_contexts.NewChatMembersContext<AnyBot>;
1144
- new_chat_photo: _gramio_contexts.NewChatPhotoContext<AnyBot>;
1145
- new_chat_title: _gramio_contexts.NewChatTitleContext<AnyBot>;
1146
- passport_data: _gramio_contexts.PassportDataContext<AnyBot>;
1147
- pinned_message: _gramio_contexts.PinnedMessageContext<AnyBot>;
1148
- poll_answer: _gramio_contexts.PollAnswerContext<AnyBot>;
1149
- poll: _gramio_contexts.PollContext<AnyBot>;
1150
- pre_checkout_query: _gramio_contexts.PreCheckoutQueryContext<AnyBot>;
1151
- proximity_alert_triggered: _gramio_contexts.ProximityAlertTriggeredContext<AnyBot>;
1152
- write_access_allowed: _gramio_contexts.WriteAccessAllowedContext<AnyBot>;
1153
- boost_added: _gramio_contexts.BoostAddedContext<AnyBot>;
1154
- chat_background_set: _gramio_contexts.ChatBackgroundSetContext<AnyBot>;
1155
- checklist_tasks_done: _gramio_contexts.ChecklistTasksDoneContext<AnyBot>;
1156
- checklist_tasks_added: _gramio_contexts.ChecklistTasksAddedContext<AnyBot>;
1157
- direct_message_price_changed: _gramio_contexts.DirectMessagePriceChangedContext<AnyBot>;
1158
- suggested_post_approved: _gramio_contexts.SuggestedPostApprovedContext<AnyBot>;
1159
- suggested_post_approval_failed: _gramio_contexts.SuggestedPostApprovalFailedContext<AnyBot>;
1160
- suggested_post_declined: _gramio_contexts.SuggestedPostDeclinedContext<AnyBot>;
1161
- suggested_post_paid: _gramio_contexts.SuggestedPostPaidContext<AnyBot>;
1162
- suggested_post_refunded: _gramio_contexts.SuggestedPostRefundedContext<AnyBot>;
1163
- forum_topic_created: _gramio_contexts.ForumTopicCreatedContext<AnyBot>;
1164
- forum_topic_edited: _gramio_contexts.ForumTopicEditedContext<AnyBot>;
1165
- forum_topic_closed: _gramio_contexts.ForumTopicClosedContext<AnyBot>;
1166
- forum_topic_reopened: _gramio_contexts.ForumTopicReopenedContext<AnyBot>;
1167
- general_forum_topic_hidden: _gramio_contexts.GeneralForumTopicHiddenContext<AnyBot>;
1168
- general_forum_topic_unhidden: _gramio_contexts.GeneralForumTopicUnhiddenContext<AnyBot>;
1169
- shipping_query: _gramio_contexts.ShippingQueryContext<AnyBot>;
1170
- successful_payment: _gramio_contexts.SuccessfulPaymentContext<AnyBot>;
1171
- refunded_payment: _gramio_contexts.RefundedPaymentContext<AnyBot>;
1172
- users_shared: _gramio_contexts.UsersSharedContext<AnyBot>;
1173
- chat_shared: _gramio_contexts.ChatSharedContext<AnyBot>;
1174
- gift: _gramio_contexts.GiftContext<AnyBot>;
1175
- gift_upgrade_sent: _gramio_contexts.GiftUpgradeSentContext<AnyBot>;
1176
- unique_gift: _gramio_contexts.UniqueGiftContext<AnyBot>;
1177
- chat_owner_left: _gramio_contexts.ChatOwnerLeftContext<AnyBot>;
1178
- chat_owner_changed: _gramio_contexts.ChatOwnerChangedContext<AnyBot>;
1179
- paid_message_price_changed: _gramio_contexts.PaidMessagePriceChangedContext<AnyBot>;
1180
- video_chat_ended: _gramio_contexts.VideoChatEndedContext<AnyBot>;
1181
- video_chat_participants_invited: _gramio_contexts.VideoChatParticipantsInvitedContext<AnyBot>;
1182
- video_chat_scheduled: _gramio_contexts.VideoChatScheduledContext<AnyBot>;
1183
- video_chat_started: _gramio_contexts.VideoChatStartedContext<AnyBot>;
1184
- web_app_data: _gramio_contexts.WebAppDataContext<AnyBot>;
1185
- service_message: _gramio_contexts.MessageContext<AnyBot>;
1186
- message_reaction: _gramio_contexts.MessageReactionContext<AnyBot>;
1187
- message_reaction_count: _gramio_contexts.MessageReactionCountContext<AnyBot>;
1188
- chat_boost: _gramio_contexts.ChatBoostContext<AnyBot>;
1189
- removed_chat_boost: _gramio_contexts.RemovedChatBoostContext<AnyBot>;
1190
- giveaway_created: _gramio_contexts.GiveawayCreatedContext<AnyBot>;
1191
- giveaway_completed: _gramio_contexts.GiveawayCompletedContext<AnyBot>;
1192
- giveaway_winners: _gramio_contexts.GiveawayWinnersContext<AnyBot>;
1193
- purchased_paid_media: _gramio_contexts.PaidMediaPurchasedContext<AnyBot>;
1194
- }, Context<AnyBot>, Context<AnyBot>, {}, {}, /*elided*/ any> & /*elided*/ any;
1195
- startParameter(parameter: RegExp | MaybeArray<string>, handler: Handler<(_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
335
+ } & _gramio_composer.EventContextOf<TThis, "message">) => unknown, macroOptions?: Record<string, unknown>): TThis;
336
+ startParameter<TThis extends _gramio_composer.ComposerLike<TThis> & {
337
+ "~": {
338
+ macros: MacroDefinitions;
339
+ Derives?: Record<string, object>;
340
+ };
341
+ chosenInlineResult(trigger: any, handler: any, macroOptions?: any): TThis;
342
+ }>(this: TThis, parameter: RegExp | MaybeArray<string>, handler: Handler<(_gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">) & {
1196
343
  rawStartPayload: string;
1197
- }>): EventComposer<Context<AnyBot>, {
1198
- callback_query: _gramio_contexts.CallbackQueryContext<AnyBot>;
1199
- chat_join_request: _gramio_contexts.ChatJoinRequestContext<AnyBot>;
1200
- chat_member: _gramio_contexts.ChatMemberContext<AnyBot>;
1201
- my_chat_member: _gramio_contexts.ChatMemberContext<AnyBot>;
1202
- chosen_inline_result: _gramio_contexts.ChosenInlineResultContext<AnyBot>;
1203
- delete_chat_photo: _gramio_contexts.DeleteChatPhotoContext<AnyBot>;
1204
- group_chat_created: _gramio_contexts.GroupChatCreatedContext<AnyBot>;
1205
- inline_query: _gramio_contexts.InlineQueryContext<AnyBot>;
1206
- invoice: _gramio_contexts.InvoiceContext<AnyBot>;
1207
- left_chat_member: _gramio_contexts.LeftChatMemberContext<AnyBot>;
1208
- location: _gramio_contexts.LocationContext<AnyBot>;
1209
- message_auto_delete_timer_changed: _gramio_contexts.MessageAutoDeleteTimerChangedContext<AnyBot>;
1210
- message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
1211
- channel_post: _gramio_contexts.MessageContext<AnyBot>;
1212
- edited_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
1213
- edited_channel_post: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
1214
- business_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
1215
- edited_business_message: _gramio_contexts.MessageContext<AnyBot> & _gramio_contexts.Require<_gramio_contexts.MessageContext<AnyBot>, "from">;
1216
- deleted_business_messages: _gramio_contexts.BusinessMessagesDeletedContext<AnyBot>;
1217
- business_connection: _gramio_contexts.BusinessConnectionContext<AnyBot>;
1218
- migrate_from_chat_id: _gramio_contexts.MigrateFromChatIdContext<AnyBot>;
1219
- migrate_to_chat_id: _gramio_contexts.MigrateToChatIdContext<AnyBot>;
1220
- new_chat_members: _gramio_contexts.NewChatMembersContext<AnyBot>;
1221
- new_chat_photo: _gramio_contexts.NewChatPhotoContext<AnyBot>;
1222
- new_chat_title: _gramio_contexts.NewChatTitleContext<AnyBot>;
1223
- passport_data: _gramio_contexts.PassportDataContext<AnyBot>;
1224
- pinned_message: _gramio_contexts.PinnedMessageContext<AnyBot>;
1225
- poll_answer: _gramio_contexts.PollAnswerContext<AnyBot>;
1226
- poll: _gramio_contexts.PollContext<AnyBot>;
1227
- pre_checkout_query: _gramio_contexts.PreCheckoutQueryContext<AnyBot>;
1228
- proximity_alert_triggered: _gramio_contexts.ProximityAlertTriggeredContext<AnyBot>;
1229
- write_access_allowed: _gramio_contexts.WriteAccessAllowedContext<AnyBot>;
1230
- boost_added: _gramio_contexts.BoostAddedContext<AnyBot>;
1231
- chat_background_set: _gramio_contexts.ChatBackgroundSetContext<AnyBot>;
1232
- checklist_tasks_done: _gramio_contexts.ChecklistTasksDoneContext<AnyBot>;
1233
- checklist_tasks_added: _gramio_contexts.ChecklistTasksAddedContext<AnyBot>;
1234
- direct_message_price_changed: _gramio_contexts.DirectMessagePriceChangedContext<AnyBot>;
1235
- suggested_post_approved: _gramio_contexts.SuggestedPostApprovedContext<AnyBot>;
1236
- suggested_post_approval_failed: _gramio_contexts.SuggestedPostApprovalFailedContext<AnyBot>;
1237
- suggested_post_declined: _gramio_contexts.SuggestedPostDeclinedContext<AnyBot>;
1238
- suggested_post_paid: _gramio_contexts.SuggestedPostPaidContext<AnyBot>;
1239
- suggested_post_refunded: _gramio_contexts.SuggestedPostRefundedContext<AnyBot>;
1240
- forum_topic_created: _gramio_contexts.ForumTopicCreatedContext<AnyBot>;
1241
- forum_topic_edited: _gramio_contexts.ForumTopicEditedContext<AnyBot>;
1242
- forum_topic_closed: _gramio_contexts.ForumTopicClosedContext<AnyBot>;
1243
- forum_topic_reopened: _gramio_contexts.ForumTopicReopenedContext<AnyBot>;
1244
- general_forum_topic_hidden: _gramio_contexts.GeneralForumTopicHiddenContext<AnyBot>;
1245
- general_forum_topic_unhidden: _gramio_contexts.GeneralForumTopicUnhiddenContext<AnyBot>;
1246
- shipping_query: _gramio_contexts.ShippingQueryContext<AnyBot>;
1247
- successful_payment: _gramio_contexts.SuccessfulPaymentContext<AnyBot>;
1248
- refunded_payment: _gramio_contexts.RefundedPaymentContext<AnyBot>;
1249
- users_shared: _gramio_contexts.UsersSharedContext<AnyBot>;
1250
- chat_shared: _gramio_contexts.ChatSharedContext<AnyBot>;
1251
- gift: _gramio_contexts.GiftContext<AnyBot>;
1252
- gift_upgrade_sent: _gramio_contexts.GiftUpgradeSentContext<AnyBot>;
1253
- unique_gift: _gramio_contexts.UniqueGiftContext<AnyBot>;
1254
- chat_owner_left: _gramio_contexts.ChatOwnerLeftContext<AnyBot>;
1255
- chat_owner_changed: _gramio_contexts.ChatOwnerChangedContext<AnyBot>;
1256
- paid_message_price_changed: _gramio_contexts.PaidMessagePriceChangedContext<AnyBot>;
1257
- video_chat_ended: _gramio_contexts.VideoChatEndedContext<AnyBot>;
1258
- video_chat_participants_invited: _gramio_contexts.VideoChatParticipantsInvitedContext<AnyBot>;
1259
- video_chat_scheduled: _gramio_contexts.VideoChatScheduledContext<AnyBot>;
1260
- video_chat_started: _gramio_contexts.VideoChatStartedContext<AnyBot>;
1261
- web_app_data: _gramio_contexts.WebAppDataContext<AnyBot>;
1262
- service_message: _gramio_contexts.MessageContext<AnyBot>;
1263
- message_reaction: _gramio_contexts.MessageReactionContext<AnyBot>;
1264
- message_reaction_count: _gramio_contexts.MessageReactionCountContext<AnyBot>;
1265
- chat_boost: _gramio_contexts.ChatBoostContext<AnyBot>;
1266
- removed_chat_boost: _gramio_contexts.RemovedChatBoostContext<AnyBot>;
1267
- giveaway_created: _gramio_contexts.GiveawayCreatedContext<AnyBot>;
1268
- giveaway_completed: _gramio_contexts.GiveawayCompletedContext<AnyBot>;
1269
- giveaway_winners: _gramio_contexts.GiveawayWinnersContext<AnyBot>;
1270
- purchased_paid_media: _gramio_contexts.PaidMediaPurchasedContext<AnyBot>;
1271
- }, Context<AnyBot>, Context<AnyBot>, {}, {}, /*elided*/ any> & /*elided*/ any;
344
+ } & _gramio_composer.EventContextOf<TThis, "message">>, macroOptions?: Record<string, unknown>): TThis;
1272
345
  };
1273
346
  /** Store plugin preRequests hooks */
1274
347
  preRequests: [Hooks.PreRequest<any>, MaybeArray<keyof APIMethods> | undefined][];
@@ -1315,7 +388,7 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
1315
388
  error<Name extends string, NewError extends {
1316
389
  new (...args: any): any;
1317
390
  prototype: Error;
1318
- }>(kind: Name, error: NewError): Plugin<Errors & { [name in Name]: InstanceType<NewError>; }, Derives>;
391
+ }>(kind: Name, error: NewError): Plugin<Errors & { [name in Name]: InstanceType<NewError>; }, Derives, Macros>;
1319
392
  /**
1320
393
  * Derive some data to handlers
1321
394
  *
@@ -1330,20 +403,34 @@ declare class Plugin<Errors extends ErrorDefinitions = {}, Derives extends Deriv
1330
403
  */
1331
404
  derive<Handler extends Hooks.Derive<Context<BotLike> & Derives["global"]>>(handler: Handler): Plugin<Errors, Derives & {
1332
405
  global: Awaited<ReturnType<Handler>>;
1333
- }>;
406
+ }, Macros>;
1334
407
  derive<Update extends UpdateName, Handler extends Hooks.Derive<ContextType<BotLike, Update> & Derives["global"] & Derives[Update]>>(updateName: MaybeArray<Update>, handler: Handler): Plugin<Errors, Derives & {
1335
408
  [K in Update]: Awaited<ReturnType<Handler>>;
1336
- }>;
409
+ }, Macros>;
1337
410
  decorate<Value extends Record<string, any>>(value: Value): Plugin<Errors, Derives & {
1338
411
  global: {
1339
412
  [K in keyof Value]: Value[K];
1340
413
  };
1341
- }>;
414
+ }, Macros>;
1342
415
  decorate<Name extends string, Value>(name: Name, value: Value): Plugin<Errors, Derives & {
1343
416
  global: {
1344
417
  [K in Name]: Value;
1345
418
  };
1346
- }>;
419
+ }, Macros>;
420
+ /**
421
+ * Register a single named macro definition on this plugin
422
+ */
423
+ macro<const Name extends string, TDef extends MacroDef<any, any>>(name: Name, definition: TDef): Plugin<Errors, Derives, Macros & Record<Name, TDef>>;
424
+ /** Register multiple macro definitions at once */
425
+ macro<const TDefs extends Record<string, MacroDef<any, any>>>(definitions: TDefs): Plugin<Errors, Derives, Macros & TDefs>;
426
+ /** Register handler with a type-narrowing filter (auto-discovers matching events) */
427
+ on<Narrowing>(filter: (ctx: any) => ctx is Narrowing, handler: Handler<ContextType<BotLike, CompatibleUpdates$1<BotLike, Narrowing>> & Derives["global"] & Narrowing>): this;
428
+ /** Register handler with a boolean filter (all updates) */
429
+ on(filter: (ctx: Context<BotLike> & Derives["global"]) => boolean, handler: Handler<Context<BotLike> & Derives["global"]>): this;
430
+ /** Register handler to one or many Updates with a type-narrowing filter */
431
+ on<T extends UpdateName, Narrowing>(updateName: MaybeArray<T>, filter: (ctx: any) => ctx is Narrowing, handler: Handler<ContextType<BotLike, T> & Derives["global"] & Derives[T] & Narrowing>): this;
432
+ /** Register handler to one or many Updates with a boolean filter (no type narrowing) */
433
+ on<T extends UpdateName>(updateName: MaybeArray<T>, filter: (ctx: ContextType<BotLike, T> & Derives["global"] & Derives[T]) => boolean, handler: Handler<ContextType<BotLike, T> & Derives["global"] & Derives[T]>): this;
1347
434
  /** Register handler to one or many Updates */
1348
435
  on<T extends UpdateName>(updateName: MaybeArray<T>, handler: Handler<ContextType<BotLike, T> & Derives["global"] & Derives[T]>): this;
1349
436
  /** Register handler to any Updates */
@@ -1722,11 +809,10 @@ declare namespace Hooks {
1722
809
  type ErrorDefinitions = Record<string, Error>;
1723
810
  /** Map of derives */
1724
811
  type DeriveDefinitions = Record<UpdateName | "global", {}>;
1725
- type FilterDefinitions = Record<string, (...args: any[]) => (context: Context<Bot>) => boolean>;
1726
812
  /** Type of Bot that accepts any generics */
1727
- type AnyBot = Bot<any, any>;
813
+ type AnyBot = Bot<any, any, any>;
1728
814
  /** Type of Bot that accepts any generics */
1729
- type AnyPlugin = Plugin<any, any>;
815
+ type AnyPlugin = Plugin<any, any, any>;
1730
816
  type CallbackQueryShorthandContext<BotType extends BotLike, Trigger extends CallbackData | string | RegExp> = Omit<ContextType<BotType, "callback_query">, "data"> & BotType["__Derives"]["global"] & BotType["__Derives"]["callback_query"] & {
1731
817
  queryData: Trigger extends CallbackData ? ReturnType<Trigger["unpack"]> : Trigger extends RegExp ? RegExpMatchArray : never;
1732
818
  };
@@ -1765,6 +851,13 @@ declare class Updates {
1765
851
  stopPolling(waitPendingRequests?: boolean): Promise<void>;
1766
852
  }
1767
853
 
854
+ /**
855
+ * Yields the subset of UpdateName whose context type contains all keys from Narrowing.
856
+ * Used to give filter-only .on() handlers a rich union type instead of the bare Context base class.
857
+ */
858
+ type CompatibleUpdates<B extends BotLike, Narrowing> = {
859
+ [K in UpdateName]: keyof Narrowing & string extends keyof ContextType<B, K> ? K : never;
860
+ }[UpdateName];
1768
861
  /** Bot instance
1769
862
  *
1770
863
  * @example
@@ -1778,7 +871,7 @@ declare class Updates {
1778
871
  * bot.start();
1779
872
  * ```
1780
873
  */
1781
- declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDefinitions = DeriveDefinitions> {
874
+ declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDefinitions = DeriveDefinitions, Macros extends MacroDefinitions = {}> {
1782
875
  /** @deprecated use `~` instead*/
1783
876
  _: {
1784
877
  /** @deprecated @internal. Remap generic */
@@ -1880,7 +973,7 @@ declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDe
1880
973
  error<Name extends string, NewError extends {
1881
974
  new (...args: any): any;
1882
975
  prototype: Error;
1883
- }>(kind: Name, error: NewError): Bot<Errors & { [name in Name]: InstanceType<NewError>; }, Derives>;
976
+ }>(kind: Name, error: NewError): Bot<Errors & { [name in Name]: InstanceType<NewError>; }, Derives, Macros>;
1884
977
  /**
1885
978
  * Set error handler.
1886
979
  * @example
@@ -1906,20 +999,42 @@ declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDe
1906
999
  */
1907
1000
  derive<Handler extends Hooks.Derive<Context<typeof this> & Derives["global"]>>(handler: Handler): Bot<Errors, Derives & {
1908
1001
  global: Awaited<ReturnType<Handler>>;
1909
- }>;
1002
+ }, Macros>;
1910
1003
  derive<Update extends UpdateName, Handler extends Hooks.Derive<ContextType<typeof this, Update> & Derives["global"] & Derives[Update]>>(updateName: MaybeArray<Update>, handler: Handler): Bot<Errors, Derives & {
1911
1004
  [K in Update]: Awaited<ReturnType<Handler>>;
1912
- }>;
1005
+ }, Macros>;
1913
1006
  decorate<Value extends Record<string, any>>(value: Value): Bot<Errors, Derives & {
1914
1007
  global: {
1915
1008
  [K in keyof Value]: Value[K];
1916
1009
  };
1917
- }>;
1010
+ }, Macros>;
1918
1011
  decorate<Name extends string, Value>(name: Name, value: Value): Bot<Errors, Derives & {
1919
1012
  global: {
1920
1013
  [K in Name]: Value;
1921
1014
  };
1922
- }>;
1015
+ }, Macros>;
1016
+ /**
1017
+ * Register a single named macro definition
1018
+ *
1019
+ * @example
1020
+ * ```ts
1021
+ * import { Bot, type MacroDef } from "gramio";
1022
+ *
1023
+ * const onlyAdmin: MacroDef = {
1024
+ * preHandler: (ctx, next) => {
1025
+ * if (ctx.from?.id !== ADMIN_ID) return;
1026
+ * return next();
1027
+ * },
1028
+ * };
1029
+ *
1030
+ * const bot = new Bot(process.env.TOKEN!)
1031
+ * .macro("onlyAdmin", onlyAdmin)
1032
+ * .command("ban", handler, { onlyAdmin: true });
1033
+ * ```
1034
+ */
1035
+ macro<const Name extends string, TDef extends MacroDef<any, any>>(name: Name, definition: TDef): Bot<Errors, Derives, Macros & Record<Name, TDef>>;
1036
+ /** Register multiple macro definitions at once */
1037
+ macro<const TDefs extends Record<string, MacroDef<any, any>>>(definitions: TDefs): Bot<Errors, Derives, Macros & TDefs>;
1923
1038
  /**
1924
1039
  * This hook called when the bot is `started`.
1925
1040
  *
@@ -2015,6 +1130,14 @@ declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDe
2015
1130
  * */
2016
1131
  onApiCall<Methods extends keyof APIMethods, Handler extends Hooks.OnApiCall<Methods>>(methods: MaybeArray<Methods>, handler: Handler): this;
2017
1132
  onApiCall(handler: Hooks.OnApiCall): this;
1133
+ /** Register handler with a type-narrowing filter (auto-discovers matching events) */
1134
+ on<Narrowing>(filter: (ctx: any) => ctx is Narrowing, handler: Handler<ContextType<typeof this, CompatibleUpdates<typeof this, Narrowing>> & Derives["global"] & Narrowing>): this;
1135
+ /** Register handler with a boolean filter (all updates) */
1136
+ on(filter: (ctx: Context<typeof this> & Derives["global"]) => boolean, handler: Handler<Context<typeof this> & Derives["global"]>): this;
1137
+ /** Register handler to one or many Updates with a type-narrowing filter */
1138
+ on<T extends UpdateName, Narrowing>(updateName: MaybeArray<T>, filter: (ctx: any) => ctx is Narrowing, handler: Handler<ContextType<typeof this, T> & Narrowing>): this;
1139
+ /** Register handler to one or many Updates with a boolean filter (no type narrowing) */
1140
+ on<T extends UpdateName>(updateName: MaybeArray<T>, filter: (ctx: ContextType<typeof this, T>) => boolean, handler: Handler<ContextType<typeof this, T>>): this;
2018
1141
  /** Register handler to one or many Updates */
2019
1142
  on<T extends UpdateName>(updateName: MaybeArray<T>, handler: Handler<ContextType<typeof this, T>>): this;
2020
1143
  /** Register handler to any Updates */
@@ -2050,10 +1173,10 @@ declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDe
2050
1173
  * });
2051
1174
  * ```
2052
1175
  */
2053
- extend<UExposed extends object, UDerives extends Record<string, object>>(composer: EventComposer<any, any, any, any, UExposed, UDerives>): Bot<Errors, Derives & {
1176
+ extend<UExposed extends object, UDerives extends Record<string, object>>(composer: EventComposer<any, any, any, any, UExposed, UDerives, any, any>): Bot<Errors, Derives & {
2054
1177
  global: UExposed;
2055
- } & UDerives>;
2056
- extend<NewPlugin extends AnyPlugin>(plugin: MaybePromise<NewPlugin>): Bot<Errors & NewPlugin["_"]["Errors"], Derives & NewPlugin["_"]["Derives"]>;
1178
+ } & UDerives, Macros>;
1179
+ extend<NewPlugin extends AnyPlugin>(plugin: MaybePromise<NewPlugin>): Bot<Errors & NewPlugin["_"]["Errors"], Derives & NewPlugin["_"]["Derives"], Macros & NewPlugin["_"]["Macros"]>;
2057
1180
  /**
2058
1181
  * Register handler to reaction (`message_reaction` update)
2059
1182
  *
@@ -2064,7 +1187,7 @@ declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDe
2064
1187
  * });
2065
1188
  * ```
2066
1189
  * */
2067
- reaction(trigger: MaybeArray<TelegramReactionTypeEmojiEmoji>, handler: (context: ContextType<typeof this, "message_reaction">) => unknown): this;
1190
+ reaction<TOptions extends HandlerOptions<ContextType<typeof this, "message_reaction">, Macros> = {}>(trigger: MaybeArray<TelegramReactionTypeEmojiEmoji>, handler: (context: ContextType<typeof this, "message_reaction"> & DeriveFromOptions<Macros, TOptions>) => unknown, options?: TOptions): this;
2068
1191
  /**
2069
1192
  * Register handler to `callback_query` event
2070
1193
  *
@@ -2088,11 +1211,11 @@ declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDe
2088
1211
  * });
2089
1212
  * ```
2090
1213
  */
2091
- callbackQuery<Trigger extends CallbackData | string | RegExp>(trigger: Trigger, handler: (context: CallbackQueryShorthandContext<typeof this, Trigger>) => unknown): this;
1214
+ callbackQuery<Trigger extends CallbackData | string | RegExp, TOptions extends HandlerOptions<CallbackQueryShorthandContext<typeof this, Trigger>, Macros> = {}>(trigger: Trigger, handler: (context: CallbackQueryShorthandContext<typeof this, Trigger> & DeriveFromOptions<Macros, TOptions>) => unknown, options?: TOptions): this;
2092
1215
  /** Register handler to `chosen_inline_result` update */
2093
- chosenInlineResult<Ctx = ContextType<typeof this, "chosen_inline_result">>(trigger: RegExp | string | ((context: Ctx) => boolean), handler: (context: Ctx & {
1216
+ chosenInlineResult<Ctx = ContextType<typeof this, "chosen_inline_result">, TOptions extends HandlerOptions<Ctx, Macros> = {}>(trigger: RegExp | string | ((context: Ctx) => boolean), handler: (context: Ctx & {
2094
1217
  args: RegExpMatchArray | null;
2095
- }) => unknown): this;
1218
+ } & DeriveFromOptions<Macros, TOptions>) => unknown, options?: TOptions): this;
2096
1219
  /**
2097
1220
  * Register handler to `inline_query` update
2098
1221
  *
@@ -2130,7 +1253,7 @@ declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDe
2130
1253
  * */
2131
1254
  inlineQuery<Ctx = ContextType<typeof this, "inline_query">>(trigger: RegExp | string | ((context: Ctx) => boolean), handler: (context: Ctx & {
2132
1255
  args: RegExpMatchArray | null;
2133
- }) => unknown, options?: {
1256
+ }) => unknown, options?: HandlerOptions<Ctx, Macros> & {
2134
1257
  onResult?: (context: ContextType<Bot, "chosen_inline_result"> & {
2135
1258
  args: RegExpMatchArray | null;
2136
1259
  }) => unknown;
@@ -2145,9 +1268,9 @@ declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDe
2145
1268
  * });
2146
1269
  * ```
2147
1270
  */
2148
- hears<Ctx = ContextType<typeof this, "message">, Trigger extends RegExp | MaybeArray<string> | ((context: Ctx) => boolean) = RegExp | MaybeArray<string> | ((context: Ctx) => boolean)>(trigger: Trigger, handler: (context: Ctx & {
1271
+ hears<Ctx = ContextType<typeof this, "message">, Trigger extends RegExp | MaybeArray<string> | ((context: Ctx) => boolean) = RegExp | MaybeArray<string> | ((context: Ctx) => boolean), TOptions extends HandlerOptions<Ctx, Macros> = {}>(trigger: Trigger, handler: (context: Ctx & {
2149
1272
  args: RegExpMatchArray | null;
2150
- }) => unknown): this;
1273
+ } & DeriveFromOptions<Macros, TOptions>) => unknown, options?: TOptions): this;
2151
1274
  /**
2152
1275
  * Register handler to `message` and `business_message` event when entities contains a command
2153
1276
  *
@@ -2158,9 +1281,9 @@ declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDe
2158
1281
  * });
2159
1282
  * ```
2160
1283
  */
2161
- command(command: MaybeArray<string>, handler: (context: ContextType<typeof this, "message"> & {
1284
+ command<TOptions extends HandlerOptions<ContextType<typeof this, "message">, Macros> = {}>(command: MaybeArray<string>, handler: (context: ContextType<typeof this, "message"> & {
2162
1285
  args: string | null;
2163
- }) => unknown): this;
1286
+ } & DeriveFromOptions<Macros, TOptions>) => unknown, options?: TOptions): this;
2164
1287
  /**
2165
1288
  * Register handler to `start` command when start parameter is matched
2166
1289
  *
@@ -2171,9 +1294,11 @@ declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDe
2171
1294
  * });
2172
1295
  * ```
2173
1296
  */
2174
- startParameter(parameter: RegExp | MaybeArray<string>, handler: Handler<ContextType<typeof this, "message"> & {
1297
+ startParameter<TOptions extends HandlerOptions<ContextType<typeof this, "message"> & {
1298
+ rawStartPayload: string;
1299
+ }, Macros> = {}>(parameter: RegExp | MaybeArray<string>, handler: Handler<ContextType<typeof this, "message"> & {
2175
1300
  rawStartPayload: string;
2176
- }>): this;
1301
+ } & DeriveFromOptions<Macros, TOptions>>, options?: TOptions): this;
2177
1302
  /** Currently not isolated!!! */
2178
1303
  group(grouped: (bot: typeof this) => AnyBot): typeof this;
2179
1304
  /**
@@ -2201,6 +1326,283 @@ declare class Bot<Errors extends ErrorDefinitions = {}, Derives extends DeriveDe
2201
1326
  stop(timeout?: number): Promise<void>;
2202
1327
  }
2203
1328
 
1329
+ /**
1330
+ * A type guard predicate that narrows `In` to `Out`.
1331
+ * Built-in filters use `any` as `In` so they work with any bot's context type.
1332
+ * The actual narrowing happens via intersection in the `.on()` handler type.
1333
+ */
1334
+ type Filter<In = any, Out extends In = In> = (context: In) => context is Out;
1335
+ type ExtractNarrow<F> = F extends Filter<any, infer N> ? N : never;
1336
+ /** Maps forward origin type strings to their concrete classes */
1337
+ type ForwardOriginMapping = {
1338
+ user: MessageOriginUser;
1339
+ chat: MessageOriginChat;
1340
+ channel: MessageOriginChannel;
1341
+ hidden_user: MessageOriginHiddenUser;
1342
+ };
1343
+ type AnyForwardOrigin = ForwardOriginMapping[keyof ForwardOriginMapping];
1344
+ interface ForwardOriginFilter {
1345
+ /** Matches any forwarded message, narrowing `forwardOrigin` to the full origin union */
1346
+ (): Filter<any, {
1347
+ forwardOrigin: AnyForwardOrigin;
1348
+ }>;
1349
+ /**
1350
+ * Matches forwarded messages of a specific origin type.
1351
+ *
1352
+ * @example
1353
+ * filters.forwardOrigin("user") // forwarded from a real user
1354
+ * filters.forwardOrigin("channel") // forwarded from a channel
1355
+ */
1356
+ <T extends keyof ForwardOriginMapping>(type: T): Filter<any, {
1357
+ forwardOrigin: ForwardOriginMapping[T];
1358
+ }>;
1359
+ }
1360
+ type ChatTypeUnion = "private" | "group" | "supergroup" | "channel";
1361
+ interface SenderChatFilter {
1362
+ /** Matches messages sent on behalf of a chat, narrowing `senderChat` to `Chat` */
1363
+ (): Filter<any, {
1364
+ senderChat: Chat;
1365
+ }>;
1366
+ /**
1367
+ * Matches messages sent on behalf of a chat of a specific type.
1368
+ *
1369
+ * @example
1370
+ * filters.senderChat("channel") // anonymous channel post
1371
+ * filters.senderChat("supergroup") // anonymous supergroup admin
1372
+ */
1373
+ <T extends ChatTypeUnion>(type: T): Filter<any, {
1374
+ senderChat: Chat & {
1375
+ type: T;
1376
+ };
1377
+ }>;
1378
+ }
1379
+ type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
1380
+ /** Union of all attachment types (shorthand for `AttachmentsMapping[keyof AttachmentsMapping]`) */
1381
+ type AnyAttachment = AttachmentsMapping[keyof AttachmentsMapping];
1382
+ declare const filters: {
1383
+ photo: Filter<any, {
1384
+ attachment: _gramio_contexts.PhotoAttachment;
1385
+ }>;
1386
+ video: Filter<any, {
1387
+ attachment: _gramio_contexts.VideoAttachment;
1388
+ }>;
1389
+ document: Filter<any, {
1390
+ attachment: _gramio_contexts.DocumentAttachment;
1391
+ }>;
1392
+ audio: Filter<any, {
1393
+ attachment: _gramio_contexts.AudioAttachment;
1394
+ }>;
1395
+ sticker: Filter<any, {
1396
+ attachment: _gramio_contexts.StickerAttachment;
1397
+ }>;
1398
+ voice: Filter<any, {
1399
+ attachment: _gramio_contexts.VoiceAttachment;
1400
+ }>;
1401
+ videoNote: Filter<any, {
1402
+ attachment: _gramio_contexts.VideoNoteAttachment;
1403
+ }>;
1404
+ animation: Filter<any, {
1405
+ attachment: _gramio_contexts.AnimationAttachment;
1406
+ }>;
1407
+ contact: Filter<any, {
1408
+ attachment: _gramio_contexts.ContactAttachment;
1409
+ }>;
1410
+ location: Filter<any, {
1411
+ attachment: _gramio_contexts.LocationAttachment;
1412
+ }>;
1413
+ poll: Filter<any, {
1414
+ attachment: _gramio_contexts.PollAttachment;
1415
+ }>;
1416
+ /** Matches any message that has an attachment */
1417
+ media: Filter<any, {
1418
+ attachment: AnyAttachment;
1419
+ }>;
1420
+ /** Matches messages that have text */
1421
+ text: Filter<any, {
1422
+ text: string;
1423
+ }>;
1424
+ /** Matches messages that have a caption */
1425
+ caption: Filter<any, {
1426
+ caption: string;
1427
+ }>;
1428
+ /** Matches messages that contain a dice */
1429
+ dice: Filter<any, {
1430
+ dice: Dice;
1431
+ }>;
1432
+ /** Matches forwarded messages. Call without args for any origin, or pass a type to narrow precisely. */
1433
+ forwardOrigin: ForwardOriginFilter;
1434
+ /** Matches messages that are replies */
1435
+ reply: Filter<any, {
1436
+ replyMessage: Message;
1437
+ }>;
1438
+ /** Matches messages that have text entities */
1439
+ entities: Filter<any, {
1440
+ entities: MessageEntity[];
1441
+ }>;
1442
+ /** Matches messages that have caption entities */
1443
+ captionEntities: Filter<any, {
1444
+ captionEntities: MessageEntity[];
1445
+ }>;
1446
+ /** Matches messages that have a quote */
1447
+ quote: Filter<any, {
1448
+ quote: TextQuote;
1449
+ }>;
1450
+ /** Matches messages sent via a bot */
1451
+ viaBot: Filter<any, {
1452
+ viaBot: User;
1453
+ }>;
1454
+ /** Matches messages that have link preview options */
1455
+ linkPreview: Filter<any, {
1456
+ linkPreviewOptions: LinkPreviewOptions;
1457
+ }>;
1458
+ /** Matches messages with a /start payload */
1459
+ startPayload: Filter<any, {
1460
+ startPayload: string;
1461
+ }>;
1462
+ /** Matches messages with a raw /start payload string */
1463
+ rawStartPayload: Filter<any, {
1464
+ rawStartPayload: string;
1465
+ }>;
1466
+ /** Matches messages with an author signature */
1467
+ authorSignature: Filter<any, {
1468
+ authorSignature: string;
1469
+ }>;
1470
+ /** Matches messages with external reply info */
1471
+ replyInfo: Filter<any, {
1472
+ externalReply: ExternalReplyInfo;
1473
+ }>;
1474
+ /** Matches contexts that have a sender (from user) */
1475
+ hasFrom: Filter<any, {
1476
+ from: User;
1477
+ senderId: number;
1478
+ }>;
1479
+ /** Matches messages sent on behalf of a chat. Pass a type to also narrow `senderChat.type`. */
1480
+ senderChat: SenderChatFilter;
1481
+ /** Matches giveaway messages */
1482
+ giveaway: Filter<any, {
1483
+ giveaway: Giveaway;
1484
+ }>;
1485
+ /** Matches messages with paid media */
1486
+ paidMedia: Filter<any, {
1487
+ paidMedia: PaidMediaInfo;
1488
+ }>;
1489
+ /** Matches messages with a game */
1490
+ game: Filter<any, {
1491
+ game: Game;
1492
+ }>;
1493
+ /** Matches messages with a story */
1494
+ story: Filter<any, {
1495
+ story: StoryAttachment;
1496
+ }>;
1497
+ /** Matches messages with an effect ID */
1498
+ effectId: Filter<any, {
1499
+ effectId: string;
1500
+ }>;
1501
+ /** Matches messages that belong to a media group */
1502
+ mediaGroup: Filter<any, {
1503
+ mediaGroupId: string;
1504
+ }>;
1505
+ /** Matches messages with a venue */
1506
+ venue: Filter<any, {
1507
+ venue: Venue;
1508
+ }>;
1509
+ /** Matches messages from bot accounts */
1510
+ isBot: (ctx: any) => boolean;
1511
+ /** Matches messages from premium users */
1512
+ isPremium: (ctx: any) => boolean;
1513
+ /** Matches messages in forum (topic) chats */
1514
+ isForum: (ctx: any) => boolean;
1515
+ /** Matches service messages */
1516
+ service: (ctx: any) => any;
1517
+ /** Matches messages in topics */
1518
+ topicMessage: (ctx: any) => any;
1519
+ /** Matches media with spoiler. Narrows `attachment` to confirm media is present. */
1520
+ mediaSpoiler: Filter<any, {
1521
+ attachment: AnyAttachment;
1522
+ }>;
1523
+ /** Matches messages with protected content. No type narrowing. */
1524
+ protectedContent: (ctx: any) => boolean;
1525
+ /** Matches messages sent while user was offline. No type narrowing. */
1526
+ fromOffline: (ctx: any) => boolean;
1527
+ /** Matches callback queries that have an associated message */
1528
+ hasMessage: Filter<any, {
1529
+ message: MessageContext<any>;
1530
+ }>;
1531
+ /** Matches callback queries that have data */
1532
+ hasData: Filter<any, {
1533
+ data: string;
1534
+ }>;
1535
+ /** Matches callback queries with an inline message ID */
1536
+ hasInlineMessageId: Filter<any, {
1537
+ inlineMessageId: string;
1538
+ }>;
1539
+ /** Matches callback queries with a game short name */
1540
+ hasGameShortName: Filter<any, {
1541
+ gameShortName: string;
1542
+ }>;
1543
+ /** Matches messages with a specific text entity type */
1544
+ entity(type: TelegramMessageEntity["type"]): Filter<any, {
1545
+ entities: MessageEntity[];
1546
+ }>;
1547
+ /** Matches messages with a specific caption entity type */
1548
+ captionEntity(type: TelegramMessageEntity["type"]): Filter<any, {
1549
+ captionEntities: MessageEntity[];
1550
+ }>;
1551
+ /** Matches messages from a specific chat type. Narrows both `chatType` and `chat.type`. */
1552
+ chat<T extends "private" | "group" | "supergroup" | "channel">(type: T): Filter<any, {
1553
+ chatType: T;
1554
+ chat: {
1555
+ type: T;
1556
+ };
1557
+ }>;
1558
+ /** Matches private (DM) chats. Narrows both `chatType` and `chat.type`. */
1559
+ pm: Filter<any, {
1560
+ chatType: "private";
1561
+ chat: {
1562
+ type: "private";
1563
+ };
1564
+ }>;
1565
+ /** Matches group chats. Narrows both `chatType` and `chat.type`. */
1566
+ group: Filter<any, {
1567
+ chatType: "group";
1568
+ chat: {
1569
+ type: "group";
1570
+ };
1571
+ }>;
1572
+ /** Matches supergroup chats. Narrows both `chatType` and `chat.type`. */
1573
+ supergroup: Filter<any, {
1574
+ chatType: "supergroup";
1575
+ chat: {
1576
+ type: "supergroup";
1577
+ };
1578
+ }>;
1579
+ /** Matches channel chats. Narrows both `chatType` and `chat.type`. */
1580
+ channel: Filter<any, {
1581
+ chatType: "channel";
1582
+ chat: {
1583
+ type: "channel";
1584
+ };
1585
+ }>;
1586
+ /** Matches messages from specific user(s). No type narrowing. */
1587
+ from(userId: number | number[]): (ctx: any) => boolean;
1588
+ /** Matches messages in specific chat(s). No type narrowing. */
1589
+ chatId(chatId: number | number[]): (ctx: any) => boolean;
1590
+ /** Matches messages whose text/caption matches the regex, sets `ctx.match` */
1591
+ regex(pattern: RegExp): Filter<any, {
1592
+ match: RegExpMatchArray;
1593
+ }>;
1594
+ /** Intersection: both filters must match */
1595
+ and<N1, N2>(f1: Filter<any, N1>, f2: Filter<any, N2>): Filter<any, N1 & N2>;
1596
+ /** Union: either filter must match */
1597
+ or<N1, N2>(f1: Filter<any, N1>, f2: Filter<any, N2>): Filter<any, N1 | N2>;
1598
+ /** Negation: inverts the filter (no type narrowing) */
1599
+ not(f: (ctx: any) => boolean): (ctx: any) => boolean;
1600
+ /** Variadic intersection: all filters must match */
1601
+ every<Filters extends Filter<any, any>[]>(...filters: Filters): Filter<any, UnionToIntersection<ExtractNarrow<Filters[number]>>>;
1602
+ /** Variadic union: any filter must match */
1603
+ some<Filters extends Filter<any, any>[]>(...filters: Filters): Filter<any, ExtractNarrow<Filters[number]>>;
1604
+ };
1605
+
2204
1606
  declare const frameworks: {
2205
1607
  elysia: ({ body, headers }: any) => {
2206
1608
  update: any;
@@ -2308,5 +1710,5 @@ declare function webhookHandler<Framework extends keyof typeof frameworks>(bot:
2308
1710
  response: () => any;
2309
1711
  } ? (...args: Parameters<(typeof frameworks)[Framework]>) => ReturnType<ReturnType<(typeof frameworks)[Framework]>["response"]> : (...args: Parameters<(typeof frameworks)[Framework]>) => void;
2310
1712
 
2311
- export { Bot, Composer, ErrorKind, Hooks, Plugin, TelegramError, Updates, webhookHandler };
2312
- export type { AllowedUpdates, AnyBot, AnyPlugin, BotOptions, BotStartOptions, BotStartOptionsLongPolling, BotStartOptionsWebhook, CallbackQueryShorthandContext, DeriveDefinitions, ErrorDefinitions, FilterDefinitions, Handler, MaybePromise, MaybeSuppressedParams, MaybeSuppressedReturn, PollingStartOptions, Suppress, SuppressedAPIMethodParams, SuppressedAPIMethodReturn, SuppressedAPIMethods, WebhookHandlerOptions, WebhookHandlerOptionsShouldWait, WebhookHandlers };
1713
+ export { Bot, Composer, ErrorKind, Hooks, Plugin, TelegramError, Updates, filters, webhookHandler };
1714
+ export type { AllowedUpdates, AnyBot, AnyPlugin, BotOptions, BotStartOptions, BotStartOptionsLongPolling, BotStartOptionsWebhook, CallbackQueryShorthandContext, DeriveDefinitions, ErrorDefinitions, Filter, Handler, MaybePromise, MaybeSuppressedParams, MaybeSuppressedReturn, PollingStartOptions, Suppress, SuppressedAPIMethodParams, SuppressedAPIMethodReturn, SuppressedAPIMethods, WebhookHandlerOptions, WebhookHandlerOptionsShouldWait, WebhookHandlers };