@sugansociety/gallagherrich 4.16.8

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.
Files changed (180) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +1024 -0
  3. package/filters.d.ts +1 -0
  4. package/filters.js +1 -0
  5. package/format.d.ts +1 -0
  6. package/format.js +1 -0
  7. package/future.d.ts +1 -0
  8. package/future.js +1 -0
  9. package/lib/button.js +102 -0
  10. package/lib/cli.mjs +105 -0
  11. package/lib/composer.js +583 -0
  12. package/lib/context.js +1280 -0
  13. package/lib/core/helpers/args.js +59 -0
  14. package/lib/core/helpers/check.js +57 -0
  15. package/lib/core/helpers/compact.js +18 -0
  16. package/lib/core/helpers/deunionize.js +14 -0
  17. package/lib/core/helpers/formatting.js +92 -0
  18. package/lib/core/helpers/util.js +51 -0
  19. package/lib/core/network/client.js +321 -0
  20. package/lib/core/network/error.js +22 -0
  21. package/lib/core/network/multipart-stream.js +62 -0
  22. package/lib/core/network/polling.js +88 -0
  23. package/lib/core/network/webhook.js +55 -0
  24. package/lib/core/types/rich-message.js +288 -0
  25. package/lib/core/types/typegram.js +29 -0
  26. package/lib/filters.js +70 -0
  27. package/lib/filters.js.map +1 -0
  28. package/lib/format.js +39 -0
  29. package/lib/format.js.map +1 -0
  30. package/lib/future.js +167 -0
  31. package/lib/future.js.map +1 -0
  32. package/lib/index.js +50 -0
  33. package/lib/input.js +62 -0
  34. package/lib/markup.js +112 -0
  35. package/lib/markup.js.map +1 -0
  36. package/lib/middleware.js +3 -0
  37. package/lib/reactions.js +85 -0
  38. package/lib/router.js +47 -0
  39. package/lib/scenes/base.js +40 -0
  40. package/lib/scenes/context.js +105 -0
  41. package/lib/scenes/index.js +22 -0
  42. package/lib/scenes/stage.js +50 -0
  43. package/lib/scenes/wizard/context.js +32 -0
  44. package/lib/scenes/wizard/index.js +46 -0
  45. package/lib/scenes.js +18 -0
  46. package/lib/scenes.js.map +1 -0
  47. package/lib/session.js +167 -0
  48. package/lib/session.js.map +1 -0
  49. package/lib/telegraf.js +273 -0
  50. package/lib/telegram-types.js +7 -0
  51. package/lib/telegram.js +1270 -0
  52. package/lib/types.js +3 -0
  53. package/lib/types.js.map +1 -0
  54. package/lib/utils.js +6 -0
  55. package/lib/utils.js.map +1 -0
  56. package/markup.d.ts +1 -0
  57. package/markup.js +1 -0
  58. package/package.json +136 -0
  59. package/scenes.d.ts +1 -0
  60. package/scenes.js +1 -0
  61. package/session.d.ts +1 -0
  62. package/session.js +1 -0
  63. package/src/button.ts +182 -0
  64. package/src/composer.ts +1008 -0
  65. package/src/context.ts +1747 -0
  66. package/src/core/helpers/args.ts +63 -0
  67. package/src/core/helpers/check.ts +71 -0
  68. package/src/core/helpers/compact.ts +18 -0
  69. package/src/core/helpers/deunionize.ts +26 -0
  70. package/src/core/helpers/formatting.ts +119 -0
  71. package/src/core/helpers/util.ts +96 -0
  72. package/src/core/network/client.ts +396 -0
  73. package/src/core/network/error.ts +29 -0
  74. package/src/core/network/multipart-stream.ts +45 -0
  75. package/src/core/network/polling.ts +94 -0
  76. package/src/core/network/webhook.ts +58 -0
  77. package/src/core/types/rich-message.ts +375 -0
  78. package/src/core/types/typegram.ts +55 -0
  79. package/src/filters.ts +109 -0
  80. package/src/format.ts +110 -0
  81. package/src/future.ts +231 -0
  82. package/src/index.ts +18 -0
  83. package/src/input.ts +59 -0
  84. package/src/markup.ts +142 -0
  85. package/src/middleware.ts +24 -0
  86. package/src/reactions.ts +118 -0
  87. package/src/router.ts +55 -0
  88. package/src/scenes/base.ts +52 -0
  89. package/src/scenes/context.ts +136 -0
  90. package/src/scenes/index.ts +21 -0
  91. package/src/scenes/stage.ts +71 -0
  92. package/src/scenes/wizard/context.ts +58 -0
  93. package/src/scenes/wizard/index.ts +63 -0
  94. package/src/scenes.ts +1 -0
  95. package/src/session.ts +204 -0
  96. package/src/telegraf.ts +380 -0
  97. package/src/telegram-types.ts +256 -0
  98. package/src/telegram.ts +1676 -0
  99. package/src/types.ts +2 -0
  100. package/src/utils.ts +1 -0
  101. package/types.d.ts +1 -0
  102. package/types.js +1 -0
  103. package/typings/button.d.ts +36 -0
  104. package/typings/button.d.ts.map +1 -0
  105. package/typings/composer.d.ts +227 -0
  106. package/typings/composer.d.ts.map +1 -0
  107. package/typings/context.d.ts +699 -0
  108. package/typings/context.d.ts.map +1 -0
  109. package/typings/core/helpers/args.d.ts +11 -0
  110. package/typings/core/helpers/args.d.ts.map +1 -0
  111. package/typings/core/helpers/check.d.ts +56 -0
  112. package/typings/core/helpers/check.d.ts.map +1 -0
  113. package/typings/core/helpers/compact.d.ts +4 -0
  114. package/typings/core/helpers/compact.d.ts.map +1 -0
  115. package/typings/core/helpers/deunionize.d.ts +18 -0
  116. package/typings/core/helpers/deunionize.d.ts.map +1 -0
  117. package/typings/core/helpers/formatting.d.ts +30 -0
  118. package/typings/core/helpers/formatting.d.ts.map +1 -0
  119. package/typings/core/helpers/util.d.ts +27 -0
  120. package/typings/core/helpers/util.d.ts.map +1 -0
  121. package/typings/core/network/client.d.ts +55 -0
  122. package/typings/core/network/client.d.ts.map +1 -0
  123. package/typings/core/network/error.d.ts +16 -0
  124. package/typings/core/network/error.d.ts.map +1 -0
  125. package/typings/core/network/multipart-stream.d.ts +20 -0
  126. package/typings/core/network/multipart-stream.d.ts.map +1 -0
  127. package/typings/core/network/polling.d.ts +16 -0
  128. package/typings/core/network/polling.d.ts.map +1 -0
  129. package/typings/core/network/webhook.d.ts +7 -0
  130. package/typings/core/network/webhook.d.ts.map +1 -0
  131. package/typings/core/types/rich-message.d.ts +144 -0
  132. package/typings/core/types/rich-message.d.ts.map +1 -0
  133. package/typings/core/types/typegram.d.ts +46 -0
  134. package/typings/core/types/typegram.d.ts.map +1 -0
  135. package/typings/filters.d.ts +18 -0
  136. package/typings/filters.d.ts.map +1 -0
  137. package/typings/format.d.ts +22 -0
  138. package/typings/format.d.ts.map +1 -0
  139. package/typings/future.d.ts +12 -0
  140. package/typings/future.d.ts.map +1 -0
  141. package/typings/index.d.ts +16 -0
  142. package/typings/index.d.ts.map +1 -0
  143. package/typings/input.d.ts +59 -0
  144. package/typings/input.d.ts.map +1 -0
  145. package/typings/markup.d.ts +27 -0
  146. package/typings/markup.d.ts.map +1 -0
  147. package/typings/middleware.d.ts +8 -0
  148. package/typings/middleware.d.ts.map +1 -0
  149. package/typings/reactions.d.ts +32 -0
  150. package/typings/reactions.d.ts.map +1 -0
  151. package/typings/router.d.ts +21 -0
  152. package/typings/router.d.ts.map +1 -0
  153. package/typings/scenes/base.d.ts +22 -0
  154. package/typings/scenes/base.d.ts.map +1 -0
  155. package/typings/scenes/context.d.ts +36 -0
  156. package/typings/scenes/context.d.ts.map +1 -0
  157. package/typings/scenes/index.d.ts +11 -0
  158. package/typings/scenes/index.d.ts.map +1 -0
  159. package/typings/scenes/stage.d.ts +24 -0
  160. package/typings/scenes/stage.d.ts.map +1 -0
  161. package/typings/scenes/wizard/context.d.ts +29 -0
  162. package/typings/scenes/wizard/context.d.ts.map +1 -0
  163. package/typings/scenes/wizard/index.d.ts +16 -0
  164. package/typings/scenes/wizard/index.d.ts.map +1 -0
  165. package/typings/scenes.d.ts +2 -0
  166. package/typings/scenes.d.ts.map +1 -0
  167. package/typings/session.d.ts +55 -0
  168. package/typings/session.d.ts.map +1 -0
  169. package/typings/telegraf.d.ts +119 -0
  170. package/typings/telegraf.d.ts.map +1 -0
  171. package/typings/telegram-types.d.ts +141 -0
  172. package/typings/telegram-types.d.ts.map +1 -0
  173. package/typings/telegram.d.ts +694 -0
  174. package/typings/telegram.d.ts.map +1 -0
  175. package/typings/types.d.ts +3 -0
  176. package/typings/types.d.ts.map +1 -0
  177. package/typings/utils.d.ts +2 -0
  178. package/typings/utils.d.ts.map +1 -0
  179. package/utils.d.ts +1 -0
  180. package/utils.js +1 -0
@@ -0,0 +1,699 @@
1
+ import * as tg from './core/types/typegram';
2
+ import * as tt from './telegram-types';
3
+ import { Deunionize, PropOr, UnionKeys } from './core/helpers/deunionize';
4
+ import ApiClient from './core/network/client';
5
+ import { Guard, Guarded, Keyed, MaybeArray } from './core/helpers/util';
6
+ import Telegram from './telegram';
7
+ import { FmtString } from './format';
8
+ import { Digit, MessageReactions } from './reactions';
9
+ type Tail<T> = T extends [unknown, ...infer U] ? U : never;
10
+ type Shorthand<FName extends Exclude<keyof Telegram, keyof ApiClient>> = Tail<Parameters<Telegram[FName]>>;
11
+ /**
12
+ * Narrows down `C['update']` (and derived getters)
13
+ * to specific update type `U`.
14
+ *
15
+ * Used by [[`Composer`]],
16
+ * possibly useful for splitting a bot into multiple files.
17
+ */
18
+ export type NarrowedContext<C extends Context, U extends tg.Update> = Context<U> & Omit<C, keyof Context>;
19
+ export type FilteredContext<Ctx extends Context, Filter extends tt.UpdateType | Guard<Ctx['update']>> = Filter extends tt.UpdateType ? NarrowedContext<Ctx, Extract<tg.Update, Record<Filter, object>>> : NarrowedContext<Ctx, Guarded<Filter>>;
20
+ export declare class Context<U extends Deunionize<tg.Update> = tg.Update> {
21
+ readonly update: U;
22
+ readonly telegram: Telegram;
23
+ readonly botInfo: tg.UserFromGetMe;
24
+ readonly state: Record<string | symbol, any>;
25
+ constructor(update: U, telegram: Telegram, botInfo: tg.UserFromGetMe);
26
+ get updateType(): Extract<UnionKeys<U>, tt.UpdateType>;
27
+ get me(): string;
28
+ /**
29
+ * @deprecated Use ctx.telegram instead
30
+ */
31
+ get tg(): Telegram;
32
+ get message(): PropOr<U, "message">;
33
+ get editedMessage(): PropOr<U, "edited_message">;
34
+ get inlineQuery(): PropOr<U, "inline_query">;
35
+ get shippingQuery(): PropOr<U, "shipping_query">;
36
+ get preCheckoutQuery(): PropOr<U, "pre_checkout_query">;
37
+ get chosenInlineResult(): PropOr<U, "chosen_inline_result">;
38
+ get channelPost(): PropOr<U, "channel_post">;
39
+ get editedChannelPost(): PropOr<U, "edited_channel_post">;
40
+ get messageReaction(): PropOr<U, "message_reaction">;
41
+ get messageReactionCount(): PropOr<U, "message_reaction_count">;
42
+ get callbackQuery(): PropOr<U, "callback_query">;
43
+ get poll(): PropOr<U, "poll">;
44
+ get pollAnswer(): PropOr<U, "poll_answer">;
45
+ get myChatMember(): PropOr<U, "my_chat_member">;
46
+ get chatMember(): PropOr<U, "chat_member">;
47
+ get chatJoinRequest(): PropOr<U, "chat_join_request">;
48
+ get chatBoost(): PropOr<U, "chat_boost">;
49
+ get removedChatBoost(): PropOr<U, "removed_chat_boost">;
50
+ /** Shorthand for any `message` object present in the current update. One of
51
+ * `message`, `edited_message`, `channel_post`, `edited_channel_post` or
52
+ * `callback_query.message`
53
+ */
54
+ get msg(): GetMsg<U> & Msg;
55
+ /** Shorthand for any message_id present in the current update. */
56
+ get msgId(): GetMsgId<U>;
57
+ get chat(): Getter<U, 'chat'>;
58
+ get senderChat(): PropOr<GetUpdateContent<U>, "sender_chat", undefined>;
59
+ get from(): GetUserFromAnySource<U>;
60
+ get inlineMessageId(): string | undefined;
61
+ get passportData(): tg.PassportData | undefined;
62
+ get webAppData(): {
63
+ data: {
64
+ json<T>(): T;
65
+ text(): string;
66
+ };
67
+ button_text: string;
68
+ } | undefined;
69
+ /**
70
+ * @deprecated use {@link Telegram.webhookReply}
71
+ */
72
+ get webhookReply(): boolean;
73
+ set webhookReply(enable: boolean);
74
+ get reactions(): MessageReactions;
75
+ /**
76
+ * @internal
77
+ */
78
+ assert<T extends string | number | object>(value: T | undefined, method: string): asserts value is T;
79
+ has<Filter extends tt.UpdateType | Guard<Context['update']>>(filters: MaybeArray<Filter>): this is FilteredContext<Context, Filter>;
80
+ get text(): GetText<U>;
81
+ entities<EntityTypes extends tg.MessageEntity['type'][]>(...types: EntityTypes): (tg.MessageEntity & {
82
+ type: EntityTypes extends [] ? "mention" | "hashtag" | "cashtag" | "bot_command" | "url" | "email" | "phone_number" | "bold" | "blockquote" | "italic" | "underline" | "strikethrough" | "spoiler" | "code" | "custom_emoji" | "pre" | "text_link" | "text_mention" : EntityTypes[number];
83
+ fragment: string;
84
+ })[];
85
+ /**
86
+ * @see https://core.telegram.org/bots/api#answerinlinequery
87
+ */
88
+ answerInlineQuery(...args: Shorthand<'answerInlineQuery'>): Promise<true>;
89
+ /**
90
+ * @see https://core.telegram.org/bots/api#answercallbackquery
91
+ */
92
+ answerCbQuery(...args: Shorthand<'answerCbQuery'>): Promise<true>;
93
+ /**
94
+ * @see https://core.telegram.org/bots/api#answercallbackquery
95
+ */
96
+ answerGameQuery(...args: Shorthand<'answerGameQuery'>): Promise<true>;
97
+ /**
98
+ * Shorthand for {@link Telegram.getUserChatBoosts}
99
+ */
100
+ getUserChatBoosts(): Promise<tg.UserChatBoosts[]>;
101
+ /**
102
+ * @see https://core.telegram.org/bots/api#answershippingquery
103
+ */
104
+ answerShippingQuery(...args: Shorthand<'answerShippingQuery'>): Promise<true>;
105
+ /**
106
+ * @see https://core.telegram.org/bots/api#answerprecheckoutquery
107
+ */
108
+ answerPreCheckoutQuery(...args: Shorthand<'answerPreCheckoutQuery'>): Promise<true>;
109
+ /**
110
+ * @see https://core.telegram.org/bots/api#editmessagetext
111
+ */
112
+ editMessageText(text: string | FmtString, extra?: tt.ExtraEditMessageText): Promise<true | (tg.Update.Edited & tg.Message.TextMessage)>;
113
+ /**
114
+ * @see https://core.telegram.org/bots/api#editmessagecaption
115
+ */
116
+ editMessageCaption(caption: string | FmtString | undefined, extra?: tt.ExtraEditMessageCaption): Promise<true | (tg.Update.Edited & tg.Message.CaptionableMessage)>;
117
+ /**
118
+ * @see https://core.telegram.org/bots/api#editmessagemedia
119
+ */
120
+ editMessageMedia(media: tt.WrapCaption<tg.InputMedia>, extra?: tt.ExtraEditMessageMedia): Promise<true | (tg.Update.Edited & tg.Message)>;
121
+ /**
122
+ * @see https://core.telegram.org/bots/api#editmessagereplymarkup
123
+ */
124
+ editMessageReplyMarkup(markup: tg.InlineKeyboardMarkup | undefined): Promise<true | (tg.Update.Edited & tg.Message)>;
125
+ /**
126
+ * @see https://core.telegram.org/bots/api#editmessagelivelocation
127
+ */
128
+ editMessageLiveLocation(latitude: number, longitude: number, extra?: tt.ExtraEditMessageLiveLocation): Promise<true | (tg.Update.Edited & tg.Message.LocationMessage)>;
129
+ /**
130
+ * @see https://core.telegram.org/bots/api#stopmessagelivelocation
131
+ */
132
+ stopMessageLiveLocation(markup?: tg.InlineKeyboardMarkup): Promise<true | (tg.Update.Edited & tg.Message.LocationMessage)>;
133
+ /**
134
+ * @see https://core.telegram.org/bots/api#sendmessage
135
+ */
136
+ sendMessage(text: string | FmtString, extra?: tt.ExtraReplyMessage): Promise<tg.Message.TextMessage>;
137
+ /**
138
+ * @see https://core.telegram.org/bots/api#sendmessage
139
+ */
140
+ reply(...args: Shorthand<'sendMessage'>): Promise<tg.Message.TextMessage>;
141
+ /**
142
+ * @see https://core.telegram.org/bots/api#getchat
143
+ */
144
+ getChat(...args: Shorthand<'getChat'>): Promise<tg.ChatFromGetChat>;
145
+ /**
146
+ * @see https://core.telegram.org/bots/api#exportchatinvitelink
147
+ */
148
+ exportChatInviteLink(...args: Shorthand<'exportChatInviteLink'>): Promise<string>;
149
+ /**
150
+ * @see https://core.telegram.org/bots/api#createchatinvitelink
151
+ */
152
+ createChatInviteLink(...args: Shorthand<'createChatInviteLink'>): Promise<tg.ChatInviteLink>;
153
+ /**
154
+ * @see https://core.telegram.org/bots/api#editchatinvitelink
155
+ */
156
+ editChatInviteLink(...args: Shorthand<'editChatInviteLink'>): Promise<tg.ChatInviteLink>;
157
+ /**
158
+ * @see https://core.telegram.org/bots/api#revokechatinvitelink
159
+ */
160
+ revokeChatInviteLink(...args: Shorthand<'revokeChatInviteLink'>): Promise<tg.ChatInviteLink>;
161
+ /**
162
+ * @see https://core.telegram.org/bots/api#banchatmember
163
+ */
164
+ banChatMember(...args: Shorthand<'banChatMember'>): Promise<true>;
165
+ /**
166
+ * @see https://core.telegram.org/bots/api#banchatmember
167
+ * @deprecated since API 5.3. Use {@link Context.banChatMember}
168
+ */
169
+ get kickChatMember(): (userId: number, untilDate?: number | undefined, extra?: Omit<{
170
+ chat_id: string | number;
171
+ user_id: number;
172
+ until_date?: number | undefined;
173
+ revoke_messages?: boolean | undefined;
174
+ }, "chat_id" | "user_id" | "until_date"> | undefined) => Promise<true>;
175
+ /**
176
+ * @see https://core.telegram.org/bots/api#unbanchatmember
177
+ */
178
+ unbanChatMember(...args: Shorthand<'unbanChatMember'>): Promise<true>;
179
+ /**
180
+ * @see https://core.telegram.org/bots/api#restrictchatmember
181
+ */
182
+ restrictChatMember(...args: Shorthand<'restrictChatMember'>): Promise<true>;
183
+ /**
184
+ * @see https://core.telegram.org/bots/api#promotechatmember
185
+ */
186
+ promoteChatMember(...args: Shorthand<'promoteChatMember'>): Promise<true>;
187
+ /**
188
+ * @see https://core.telegram.org/bots/api#setchatadministratorcustomtitle
189
+ */
190
+ setChatAdministratorCustomTitle(...args: Shorthand<'setChatAdministratorCustomTitle'>): Promise<true>;
191
+ /**
192
+ * @see https://core.telegram.org/bots/api#setchatphoto
193
+ */
194
+ setChatPhoto(...args: Shorthand<'setChatPhoto'>): Promise<true>;
195
+ /**
196
+ * @see https://core.telegram.org/bots/api#deletechatphoto
197
+ */
198
+ deleteChatPhoto(...args: Shorthand<'deleteChatPhoto'>): Promise<true>;
199
+ /**
200
+ * @see https://core.telegram.org/bots/api#setchattitle
201
+ */
202
+ setChatTitle(...args: Shorthand<'setChatTitle'>): Promise<true>;
203
+ /**
204
+ * @see https://core.telegram.org/bots/api#setchatdescription
205
+ */
206
+ setChatDescription(...args: Shorthand<'setChatDescription'>): Promise<true>;
207
+ /**
208
+ * @see https://core.telegram.org/bots/api#pinchatmessage
209
+ */
210
+ pinChatMessage(...args: Shorthand<'pinChatMessage'>): Promise<true>;
211
+ /**
212
+ * @see https://core.telegram.org/bots/api#unpinchatmessage
213
+ */
214
+ unpinChatMessage(...args: Shorthand<'unpinChatMessage'>): Promise<true>;
215
+ /**
216
+ * @see https://core.telegram.org/bots/api#unpinallchatmessages
217
+ */
218
+ unpinAllChatMessages(...args: Shorthand<'unpinAllChatMessages'>): Promise<true>;
219
+ /**
220
+ * @see https://core.telegram.org/bots/api#leavechat
221
+ */
222
+ leaveChat(...args: Shorthand<'leaveChat'>): Promise<true>;
223
+ /**
224
+ * @see https://core.telegram.org/bots/api#setchatpermissions
225
+ */
226
+ setChatPermissions(...args: Shorthand<'setChatPermissions'>): Promise<true>;
227
+ /**
228
+ * @see https://core.telegram.org/bots/api#getchatadministrators
229
+ */
230
+ getChatAdministrators(...args: Shorthand<'getChatAdministrators'>): Promise<(tg.ChatMemberOwner | tg.ChatMemberAdministrator)[]>;
231
+ /**
232
+ * @see https://core.telegram.org/bots/api#getchatmember
233
+ */
234
+ getChatMember(...args: Shorthand<'getChatMember'>): Promise<tg.ChatMember>;
235
+ /**
236
+ * @see https://core.telegram.org/bots/api#getchatmembercount
237
+ */
238
+ getChatMembersCount(...args: Shorthand<'getChatMembersCount'>): Promise<number>;
239
+ /**
240
+ * @see https://core.telegram.org/bots/api#setpassportdataerrors
241
+ */
242
+ setPassportDataErrors(errors: readonly tg.PassportElementError[]): Promise<true>;
243
+ /**
244
+ * @see https://core.telegram.org/bots/api#sendphoto
245
+ */
246
+ sendPhoto(photo: string | tg.InputFile, extra?: tt.ExtraPhoto): Promise<tg.Message.PhotoMessage>;
247
+ /**
248
+ * @see https://core.telegram.org/bots/api#sendphoto
249
+ */
250
+ replyWithPhoto(...args: Shorthand<'sendPhoto'>): Promise<tg.Message.PhotoMessage>;
251
+ /**
252
+ * @see https://core.telegram.org/bots/api#sendmediagroup
253
+ */
254
+ sendMediaGroup(media: tt.MediaGroup, extra?: tt.ExtraMediaGroup): Promise<(tg.Message.DocumentMessage | tg.Message.AudioMessage | tg.Message.PhotoMessage | tg.Message.VideoMessage)[]>;
255
+ /**
256
+ * @see https://core.telegram.org/bots/api#sendmediagroup
257
+ */
258
+ replyWithMediaGroup(...args: Shorthand<'sendMediaGroup'>): Promise<(tg.Message.DocumentMessage | tg.Message.AudioMessage | tg.Message.PhotoMessage | tg.Message.VideoMessage)[]>;
259
+ /**
260
+ * @see https://core.telegram.org/bots/api#sendaudio
261
+ */
262
+ sendAudio(audio: string | tg.InputFile, extra?: tt.ExtraAudio): Promise<tg.Message.AudioMessage>;
263
+ /**
264
+ * @see https://core.telegram.org/bots/api#sendaudio
265
+ */
266
+ replyWithAudio(...args: Shorthand<'sendAudio'>): Promise<tg.Message.AudioMessage>;
267
+ /**
268
+ * @see https://core.telegram.org/bots/api#senddice
269
+ */
270
+ sendDice(extra?: tt.ExtraDice): Promise<tg.Message.DiceMessage>;
271
+ /**
272
+ * @see https://core.telegram.org/bots/api#senddice
273
+ */
274
+ replyWithDice(...args: Shorthand<'sendDice'>): Promise<tg.Message.DiceMessage>;
275
+ /**
276
+ * @see https://core.telegram.org/bots/api#senddocument
277
+ */
278
+ sendDocument(document: string | tg.InputFile, extra?: tt.ExtraDocument): Promise<tg.Message.DocumentMessage>;
279
+ /**
280
+ * @see https://core.telegram.org/bots/api#senddocument
281
+ */
282
+ replyWithDocument(...args: Shorthand<'sendDocument'>): Promise<tg.Message.DocumentMessage>;
283
+ /**
284
+ * @see https://core.telegram.org/bots/api#sendsticker
285
+ */
286
+ sendSticker(sticker: string | tg.InputFile, extra?: tt.ExtraSticker): Promise<tg.Message.StickerMessage>;
287
+ /**
288
+ * @see https://core.telegram.org/bots/api#sendsticker
289
+ */
290
+ replyWithSticker(...args: Shorthand<'sendSticker'>): Promise<tg.Message.StickerMessage>;
291
+ /**
292
+ * @see https://core.telegram.org/bots/api#sendvideo
293
+ */
294
+ sendVideo(video: string | tg.InputFile, extra?: tt.ExtraVideo): Promise<tg.Message.VideoMessage>;
295
+ /**
296
+ * @see https://core.telegram.org/bots/api#sendvideo
297
+ */
298
+ replyWithVideo(...args: Shorthand<'sendVideo'>): Promise<tg.Message.VideoMessage>;
299
+ /**
300
+ * @see https://core.telegram.org/bots/api#sendanimation
301
+ */
302
+ sendAnimation(animation: string | tg.InputFile, extra?: tt.ExtraAnimation): Promise<tg.Message.AnimationMessage>;
303
+ /**
304
+ * @see https://core.telegram.org/bots/api#sendanimation
305
+ */
306
+ replyWithAnimation(...args: Shorthand<'sendAnimation'>): Promise<tg.Message.AnimationMessage>;
307
+ /**
308
+ * @see https://core.telegram.org/bots/api#sendvideonote
309
+ */
310
+ sendVideoNote(videoNote: string | tg.InputFileVideoNote, extra?: tt.ExtraVideoNote): Promise<tg.Message.VideoNoteMessage>;
311
+ /**
312
+ * @see https://core.telegram.org/bots/api#sendvideonote
313
+ */
314
+ replyWithVideoNote(...args: Shorthand<'sendVideoNote'>): Promise<tg.Message.VideoNoteMessage>;
315
+ /**
316
+ * @see https://core.telegram.org/bots/api#sendinvoice
317
+ */
318
+ sendInvoice(invoice: tt.NewInvoiceParameters, extra?: tt.ExtraInvoice): Promise<tg.Message.InvoiceMessage>;
319
+ /**
320
+ * @see https://core.telegram.org/bots/api#sendinvoice
321
+ */
322
+ replyWithInvoice(...args: Shorthand<'sendInvoice'>): Promise<tg.Message.InvoiceMessage>;
323
+ /**
324
+ * @see https://core.telegram.org/bots/api#sendgame
325
+ */
326
+ sendGame(game: string, extra?: tt.ExtraGame): Promise<tg.Message.GameMessage>;
327
+ /**
328
+ * @see https://core.telegram.org/bots/api#sendgame
329
+ */
330
+ replyWithGame(...args: Shorthand<'sendGame'>): Promise<tg.Message.GameMessage>;
331
+ /**
332
+ * @see https://core.telegram.org/bots/api#sendvoice
333
+ */
334
+ sendVoice(voice: string | tg.InputFile, extra?: tt.ExtraVoice): Promise<tg.Message.VoiceMessage>;
335
+ /**
336
+ * @see https://core.telegram.org/bots/api#sendvoice
337
+ */
338
+ replyWithVoice(...args: Shorthand<'sendVoice'>): Promise<tg.Message.VoiceMessage>;
339
+ /**
340
+ * @see https://core.telegram.org/bots/api#sendpoll
341
+ */
342
+ sendPoll(poll: string, options: readonly string[], extra?: tt.ExtraPoll): Promise<tg.Message.PollMessage>;
343
+ /**
344
+ * @see https://core.telegram.org/bots/api#sendpoll
345
+ */
346
+ replyWithPoll(...args: Shorthand<'sendPoll'>): Promise<tg.Message.PollMessage>;
347
+ /**
348
+ * @see https://core.telegram.org/bots/api#sendpoll
349
+ */
350
+ sendQuiz(quiz: string, options: readonly string[], extra?: tt.ExtraPoll): Promise<tg.Message.PollMessage>;
351
+ /**
352
+ * @see https://core.telegram.org/bots/api#sendpoll
353
+ */
354
+ replyWithQuiz(...args: Shorthand<'sendQuiz'>): Promise<tg.Message.PollMessage>;
355
+ /**
356
+ * @see https://core.telegram.org/bots/api#stoppoll
357
+ */
358
+ stopPoll(...args: Shorthand<'stopPoll'>): Promise<tg.Poll>;
359
+ /**
360
+ * @see https://core.telegram.org/bots/api#sendchataction
361
+ */
362
+ sendChatAction(action: Shorthand<'sendChatAction'>[0], extra?: tt.ExtraSendChatAction): Promise<true>;
363
+ /**
364
+ * @see https://core.telegram.org/bots/api#sendchataction
365
+ *
366
+ * Sends the sendChatAction request repeatedly, with a delay between requests,
367
+ * as long as the provided callback function is being processed.
368
+ *
369
+ * The sendChatAction errors should be ignored, because the goal is the actual long process completing and performing an action.
370
+ *
371
+ * @param action - chat action type.
372
+ * @param callback - a function to run along with the chat action.
373
+ * @param extra - extra parameters for sendChatAction.
374
+ * @param {number} [extra.intervalDuration=8000] - The duration (in milliseconds) between subsequent sendChatAction requests.
375
+ */
376
+ persistentChatAction(action: Shorthand<'sendChatAction'>[0], callback: () => Promise<void>, { intervalDuration, ...extra }?: tt.ExtraSendChatAction & {
377
+ intervalDuration?: number;
378
+ }): Promise<void>;
379
+ /**
380
+ * @deprecated use {@link Context.sendChatAction} instead
381
+ * @see https://core.telegram.org/bots/api#sendchataction
382
+ */
383
+ replyWithChatAction(...args: Shorthand<'sendChatAction'>): Promise<true>;
384
+ /**
385
+ * Shorthand for {@link Telegram.setMessageReaction}
386
+ * @param reaction An emoji or custom_emoji_id to set as reaction to current message. Leave empty to remove reactions.
387
+ * @param is_big Pass True to set the reaction with a big animation
388
+ */
389
+ react(reaction?: MaybeArray<tg.TelegramEmoji | `${Digit}${string}` | tg.ReactionType>, is_big?: boolean): Promise<true>;
390
+ /**
391
+ * @see https://core.telegram.org/bots/api#sendlocation
392
+ */
393
+ sendLocation(latitude: number, longitude: number, extra?: tt.ExtraLocation): Promise<tg.Message.LocationMessage>;
394
+ /**
395
+ * @see https://core.telegram.org/bots/api#sendlocation
396
+ */
397
+ replyWithLocation(...args: Shorthand<'sendLocation'>): Promise<tg.Message.LocationMessage>;
398
+ /**
399
+ * @see https://core.telegram.org/bots/api#sendvenue
400
+ */
401
+ sendVenue(latitude: number, longitude: number, title: string, address: string, extra?: tt.ExtraVenue): Promise<tg.Message.VenueMessage>;
402
+ /**
403
+ * @see https://core.telegram.org/bots/api#sendvenue
404
+ */
405
+ replyWithVenue(...args: Shorthand<'sendVenue'>): Promise<tg.Message.VenueMessage>;
406
+ /**
407
+ * @see https://core.telegram.org/bots/api#sendcontact
408
+ */
409
+ sendContact(phoneNumber: string, firstName: string, extra?: tt.ExtraContact): Promise<tg.Message.ContactMessage>;
410
+ /**
411
+ * @see https://core.telegram.org/bots/api#sendcontact
412
+ */
413
+ replyWithContact(...args: Shorthand<'sendContact'>): Promise<tg.Message.ContactMessage>;
414
+ /**
415
+ * @deprecated use {@link Telegram.getStickerSet}
416
+ * @see https://core.telegram.org/bots/api#getstickerset
417
+ */
418
+ getStickerSet(setName: string): Promise<tg.StickerSet>;
419
+ /**
420
+ * @see https://core.telegram.org/bots/api#setchatstickerset
421
+ */
422
+ setChatStickerSet(setName: string): Promise<true>;
423
+ /**
424
+ * @see https://core.telegram.org/bots/api#deletechatstickerset
425
+ */
426
+ deleteChatStickerSet(): Promise<true>;
427
+ /**
428
+ * Use this method to create a topic in a forum supergroup chat. The bot must be an administrator in the chat for this
429
+ * to work and must have the can_manage_topics administrator rights. Returns information about the created topic as a
430
+ * ForumTopic object.
431
+ *
432
+ * @see https://core.telegram.org/bots/api#createforumtopic
433
+ */
434
+ createForumTopic(...args: Shorthand<'createForumTopic'>): Promise<tg.ForumTopic>;
435
+ /**
436
+ * Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in
437
+ * the chat for this to work and must have can_manage_topics administrator rights, unless it is the creator of the
438
+ * topic. Returns True on success.
439
+ *
440
+ * @see https://core.telegram.org/bots/api#editforumtopic
441
+ */
442
+ editForumTopic(extra: tt.ExtraEditForumTopic): Promise<true>;
443
+ /**
444
+ * Use this method to close an open topic in a forum supergroup chat. The bot must be an administrator in the chat
445
+ * for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic.
446
+ * Returns True on success.
447
+ *
448
+ * @see https://core.telegram.org/bots/api#closeforumtopic
449
+ */
450
+ closeForumTopic(): Promise<true>;
451
+ /**
452
+ * Use this method to reopen a closed topic in a forum supergroup chat. The bot must be an administrator in the chat
453
+ * for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic.
454
+ * Returns True on success.
455
+ *
456
+ * @see https://core.telegram.org/bots/api#reopenforumtopic
457
+ */
458
+ reopenForumTopic(): Promise<true>;
459
+ /**
460
+ * Use this method to delete a forum topic along with all its messages in a forum supergroup chat. The bot must be an
461
+ * administrator in the chat for this to work and must have the can_delete_messages administrator rights.
462
+ * Returns True on success.
463
+ *
464
+ * @see https://core.telegram.org/bots/api#deleteforumtopic
465
+ */
466
+ deleteForumTopic(): Promise<true>;
467
+ /**
468
+ * Use this method to clear the list of pinned messages in a forum topic. The bot must be an administrator in the chat
469
+ * for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success.
470
+ *
471
+ * @see https://core.telegram.org/bots/api#unpinallforumtopicmessages
472
+ */
473
+ unpinAllForumTopicMessages(): Promise<true>;
474
+ /**
475
+ * Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator
476
+ * in the chat for this to work and must have can_manage_topics administrator rights. Returns True on success.
477
+ *
478
+ * @see https://core.telegram.org/bots/api#editgeneralforumtopic
479
+ */
480
+ editGeneralForumTopic(name: string): Promise<true>;
481
+ /**
482
+ * Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the
483
+ * chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.
484
+ *
485
+ * @see https://core.telegram.org/bots/api#closegeneralforumtopic
486
+ */
487
+ closeGeneralForumTopic(): Promise<true>;
488
+ /**
489
+ * Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in
490
+ * the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically
491
+ * unhidden if it was hidden. Returns True on success.
492
+ *
493
+ * @see https://core.telegram.org/bots/api#reopengeneralforumtopic
494
+ */
495
+ reopenGeneralForumTopic(): Promise<true>;
496
+ /**
497
+ * Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat
498
+ * for this to work and must have the can_manage_topics administrator rights. The topic will be automatically closed
499
+ * if it was open. Returns True on success.
500
+ *
501
+ * @see https://core.telegram.org/bots/api#hidegeneralforumtopic
502
+ */
503
+ hideGeneralForumTopic(): Promise<true>;
504
+ /**
505
+ * Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the
506
+ * chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.
507
+ *
508
+ * @see https://core.telegram.org/bots/api#unhidegeneralforumtopic
509
+ */
510
+ unhideGeneralForumTopic(): Promise<true>;
511
+ /**
512
+ * Use this method to clear the list of pinned messages in a General forum topic.
513
+ * The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator
514
+ * right in the supergroup.
515
+ *
516
+ * @param chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
517
+ *
518
+ * @see https://core.telegram.org/bots/api#unpinallgeneralforumtopicmessages
519
+ */
520
+ unpinAllGeneralForumTopicMessages(): Promise<true>;
521
+ /**
522
+ * @deprecated use {@link Telegram.setStickerPositionInSet}
523
+ * @see https://core.telegram.org/bots/api#setstickerpositioninset
524
+ */
525
+ setStickerPositionInSet(sticker: string, position: number): Promise<true>;
526
+ /**
527
+ * @deprecated use {@link Telegram.setStickerSetThumbnail}
528
+ * @see https://core.telegram.org/bots/api#setstickersetthumbnail
529
+ */
530
+ setStickerSetThumb(...args: Parameters<Telegram['setStickerSetThumbnail']>): Promise<true>;
531
+ setStickerSetThumbnail(...args: Parameters<Telegram['setStickerSetThumbnail']>): Promise<true>;
532
+ setStickerMaskPosition(...args: Parameters<Telegram['setStickerMaskPosition']>): Promise<true>;
533
+ setStickerKeywords(...args: Parameters<Telegram['setStickerKeywords']>): Promise<true>;
534
+ setStickerEmojiList(...args: Parameters<Telegram['setStickerEmojiList']>): Promise<true>;
535
+ deleteStickerSet(...args: Parameters<Telegram['deleteStickerSet']>): Promise<true>;
536
+ setStickerSetTitle(...args: Parameters<Telegram['setStickerSetTitle']>): Promise<true>;
537
+ setCustomEmojiStickerSetThumbnail(...args: Parameters<Telegram['setCustomEmojiStickerSetThumbnail']>): Promise<true>;
538
+ /**
539
+ * @deprecated use {@link Telegram.deleteStickerFromSet}
540
+ * @see https://core.telegram.org/bots/api#deletestickerfromset
541
+ */
542
+ deleteStickerFromSet(sticker: string): Promise<true>;
543
+ /**
544
+ * @see https://core.telegram.org/bots/api#uploadstickerfile
545
+ */
546
+ uploadStickerFile(...args: Shorthand<'uploadStickerFile'>): Promise<tg.File>;
547
+ /**
548
+ * @see https://core.telegram.org/bots/api#createnewstickerset
549
+ */
550
+ createNewStickerSet(...args: Shorthand<'createNewStickerSet'>): Promise<true>;
551
+ /**
552
+ * @see https://core.telegram.org/bots/api#addstickertoset
553
+ */
554
+ addStickerToSet(...args: Shorthand<'addStickerToSet'>): Promise<true>;
555
+ /**
556
+ * @deprecated use {@link Telegram.getMyCommands}
557
+ * @see https://core.telegram.org/bots/api#getmycommands
558
+ */
559
+ getMyCommands(): Promise<tg.BotCommand[]>;
560
+ /**
561
+ * @deprecated use {@link Telegram.setMyCommands}
562
+ * @see https://core.telegram.org/bots/api#setmycommands
563
+ */
564
+ setMyCommands(commands: readonly tg.BotCommand[]): Promise<true>;
565
+ /**
566
+ * @deprecated use {@link Context.replyWithMarkdownV2}
567
+ * @see https://core.telegram.org/bots/api#sendmessage
568
+ */
569
+ replyWithMarkdown(markdown: string, extra?: tt.ExtraReplyMessage): Promise<tg.Message.TextMessage>;
570
+ /**
571
+ * @see https://core.telegram.org/bots/api#sendmessage
572
+ */
573
+ replyWithMarkdownV2(markdown: string, extra?: tt.ExtraReplyMessage): Promise<tg.Message.TextMessage>;
574
+ /**
575
+ * @see https://core.telegram.org/bots/api#sendmessage
576
+ */
577
+ replyWithHTML(html: string, extra?: tt.ExtraReplyMessage): Promise<tg.Message.TextMessage>;
578
+ /**
579
+ * Context-aware shorthand for {@link Telegram.sendRichMessage}.
580
+ * Sends a structured rich message to the current chat.
581
+ * @see https://core.telegram.org/bots/api#sendrichmessage
582
+ */
583
+ sendRichMessage(richMessage: tg.InputRichMessage, extra?: tt.ExtraSendRichMessage): Promise<never>;
584
+ /**
585
+ * Context-aware shorthand for {@link Telegram.sendRichMessageDraft}.
586
+ * Streams a partial rich message (private chats only). Draft is ephemeral (30s).
587
+ * Must finalize with sendRichMessage using the same draft_id.
588
+ * @param draftId Non-zero draft ID; updates with same ID are animated
589
+ * @see https://core.telegram.org/bots/api#sendrichmessagedraft
590
+ */
591
+ sendRichMessageDraft(draftId: number, richMessage: tg.InputRichMessage, extra?: tt.ExtraSendRichMessageDraft): Promise<never>;
592
+ /**
593
+ * Reply to the current message with a rich message.
594
+ * Convenience wrapper around {@link Context.sendRichMessage} that sets reply_parameters automatically.
595
+ */
596
+ replyWithRichMessageContent(richMessage: tg.InputRichMessage, extra?: tt.ExtraSendRichMessage): Promise<never>;
597
+ /**
598
+ * Send a rich message with combined text, inline keyboard, parse mode, and link preview options.
599
+ *
600
+ * @example
601
+ * ctx.replyWithRichMessage({
602
+ * text: '<b>Hello!</b> Choose an option:',
603
+ * parseMode: 'HTML',
604
+ * buttons: [
605
+ * [{ text: 'Visit Website', url: 'https://example.com' }],
606
+ * [{ text: 'Callback', callback_data: 'my_action' }],
607
+ * ],
608
+ * disableLinkPreview: true,
609
+ * })
610
+ */
611
+ replyWithRichMessage(options: {
612
+ text: string;
613
+ parseMode?: 'HTML' | 'Markdown' | 'MarkdownV2';
614
+ buttons?: tg.InlineKeyboardButton[][];
615
+ disableLinkPreview?: boolean;
616
+ extra?: tt.ExtraReplyMessage;
617
+ }): Promise<tg.Message.TextMessage>;
618
+ /**
619
+ * @see https://core.telegram.org/bots/api#deletemessage
620
+ */
621
+ deleteMessage(messageId?: number): Promise<true>;
622
+ /**
623
+ * Context-aware shorthand for {@link Telegram.deleteMessages}
624
+ * @param messageIds Identifiers of 1-100 messages to delete. See deleteMessage for limitations on which messages can be deleted
625
+ */
626
+ deleteMessages(messageIds: number[]): Promise<true>;
627
+ /**
628
+ * @see https://core.telegram.org/bots/api#forwardmessage
629
+ */
630
+ forwardMessage(chatId: string | number, extra?: Shorthand<'forwardMessage'>[2]): Promise<tg.Message>;
631
+ /**
632
+ * Shorthand for {@link Telegram.forwardMessages}
633
+ * @see https://core.telegram.org/bots/api#forwardmessages
634
+ */
635
+ forwardMessages(chatId: string | number, messageIds: number[], extra?: Shorthand<'forwardMessages'>[2]): Promise<tg.MessageId[]>;
636
+ /**
637
+ * @see https://core.telegram.org/bots/api#copymessage
638
+ */
639
+ copyMessage(chatId: string | number, extra?: tt.ExtraCopyMessage): Promise<tg.MessageId>;
640
+ /**
641
+ * Context-aware shorthand for {@link Telegram.copyMessages}
642
+ * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
643
+ * @param messageIds Identifiers of 1-100 messages in the chat from_chat_id to copy. The identifiers must be specified in a strictly increasing order.
644
+ */
645
+ copyMessages(chatId: number | string, messageIds: number[], extra?: tt.ExtraCopyMessages): Promise<tg.MessageId[]>;
646
+ /**
647
+ * @see https://core.telegram.org/bots/api#approvechatjoinrequest
648
+ */
649
+ approveChatJoinRequest(userId: number): Promise<true>;
650
+ /**
651
+ * @see https://core.telegram.org/bots/api#declinechatjoinrequest
652
+ */
653
+ declineChatJoinRequest(userId: number): Promise<true>;
654
+ /**
655
+ * @see https://core.telegram.org/bots/api#banchatsenderchat
656
+ */
657
+ banChatSenderChat(senderChatId: number): Promise<true>;
658
+ /**
659
+ * @see https://core.telegram.org/bots/api#unbanchatsenderchat
660
+ */
661
+ unbanChatSenderChat(senderChatId: number): Promise<true>;
662
+ /**
663
+ * Use this method to change the bot's menu button in the current private chat. Returns true on success.
664
+ * @see https://core.telegram.org/bots/api#setchatmenubutton
665
+ */
666
+ setChatMenuButton(menuButton?: tg.MenuButton): Promise<true>;
667
+ /**
668
+ * Use this method to get the current value of the bot's menu button in the current private chat. Returns MenuButton on success.
669
+ * @see https://core.telegram.org/bots/api#getchatmenubutton
670
+ */
671
+ getChatMenuButton(): Promise<tg.MenuButton>;
672
+ /**
673
+ * @see https://core.telegram.org/bots/api#setmydefaultadministratorrights
674
+ */
675
+ setMyDefaultAdministratorRights(extra?: Parameters<Telegram['setMyDefaultAdministratorRights']>[0]): Promise<true>;
676
+ /**
677
+ * @see https://core.telegram.org/bots/api#getmydefaultadministratorrights
678
+ */
679
+ getMyDefaultAdministratorRights(extra?: Parameters<Telegram['getMyDefaultAdministratorRights']>[0]): Promise<tg.ChatAdministratorRights>;
680
+ }
681
+ export default Context;
682
+ type UpdateTypes<U extends Deunionize<tg.Update>> = Extract<UnionKeys<U>, tt.UpdateType>;
683
+ export type GetUpdateContent<U extends tg.Update> = U extends tg.Update.CallbackQueryUpdate ? U['callback_query']['message'] : U[UpdateTypes<U>];
684
+ type Getter<U extends Deunionize<tg.Update>, P extends string> = PropOr<GetUpdateContent<U>, P>;
685
+ interface Msg {
686
+ isAccessible(): this is MaybeMessage<tg.Message>;
687
+ has<Ks extends UnionKeys<tg.Message>[]>(...keys: Ks): this is MaybeMessage<Keyed<tg.Message, Ks[number]>>;
688
+ }
689
+ declare const Msg: Msg;
690
+ export type MaybeMessage<M extends tg.MaybeInaccessibleMessage = tg.MaybeInaccessibleMessage> = M & Msg;
691
+ type GetMsg<U extends tg.Update> = U extends tg.Update.MessageUpdate ? U['message'] : U extends tg.Update.ChannelPostUpdate ? U['channel_post'] : U extends tg.Update.EditedChannelPostUpdate ? U['edited_channel_post'] : U extends tg.Update.EditedMessageUpdate ? U['edited_message'] : U extends tg.Update.CallbackQueryUpdate ? U['callback_query']['message'] : undefined;
692
+ type GetUserFromAnySource<U extends tg.Update> = GetMsg<U> extends {
693
+ from: tg.User;
694
+ } ? tg.User : U extends tg.Update.CallbackQueryUpdate | tg.Update.InlineQueryUpdate | tg.Update.ShippingQueryUpdate | tg.Update.PreCheckoutQueryUpdate | tg.Update.ChosenInlineResultUpdate | tg.Update.ChatMemberUpdate | tg.Update.MyChatMemberUpdate | tg.Update.ChatJoinRequestUpdate | tg.Update.MessageReactionUpdate | tg.Update.PollAnswerUpdate | tg.Update.ChatBoostUpdate ? tg.User : undefined;
695
+ type GetMsgId<U extends tg.Update> = GetMsg<U> extends {
696
+ message_id: number;
697
+ } ? number : U extends tg.Update.MessageReactionUpdate ? number : U extends tg.Update.MessageReactionCountUpdate ? number : undefined;
698
+ type GetText<U extends tg.Update> = GetMsg<U> extends tg.Message.TextMessage ? string : GetMsg<U> extends tg.Message ? string | undefined : U extends tg.Update.PollUpdate ? string | undefined : undefined;
699
+ //# sourceMappingURL=context.d.ts.map