teledzik 1.0.0

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