1 | import * as tg from './core/types/typegram';
|
2 | import * as tt from './telegram-types';
|
3 | import { Deunionize, PropOr, UnionKeys } from './deunionize';
|
4 | import ApiClient from './core/network/client';
|
5 | import { Guard, Guarded, MaybeArray } from './core/helpers/util';
|
6 | import Telegram from './telegram';
|
7 | import { FmtString } from './format';
|
8 | type Tail<T> = T extends [unknown, ...infer U] ? U : never;
|
9 | type Shorthand<FName extends Exclude<keyof Telegram, keyof ApiClient>> = Tail<Parameters<Telegram[FName]>>;
|
10 | /**
|
11 | * Narrows down `C['update']` (and derived getters)
|
12 | * to specific update type `U`.
|
13 | *
|
14 | * Used by [[`Composer`]],
|
15 | * possibly useful for splitting a bot into multiple files.
|
16 | */
|
17 | export type NarrowedContext<C extends Context, U extends tg.Update> = Context<U> & Omit<C, keyof Context>;
|
18 | 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>>;
|
19 | export declare class Context<U extends Deunionize<tg.Update> = tg.Update> {
|
20 | readonly update: U;
|
21 | readonly telegram: Telegram;
|
22 | readonly botInfo: tg.UserFromGetMe;
|
23 | readonly state: Record<string | symbol, any>;
|
24 | constructor(update: U, telegram: Telegram, botInfo: tg.UserFromGetMe);
|
25 | get updateType(): Extract<UnionKeys<U>, tt.UpdateType>;
|
26 | get me(): string;
|
27 | /**
|
28 | * @deprecated Use ctx.telegram instead
|
29 | */
|
30 | get tg(): Telegram;
|
31 | get message(): PropOr<U, "message">;
|
32 | get editedMessage(): PropOr<U, "edited_message">;
|
33 | get inlineQuery(): PropOr<U, "inline_query">;
|
34 | get shippingQuery(): PropOr<U, "shipping_query">;
|
35 | get preCheckoutQuery(): PropOr<U, "pre_checkout_query">;
|
36 | get chosenInlineResult(): PropOr<U, "chosen_inline_result">;
|
37 | get channelPost(): PropOr<U, "channel_post">;
|
38 | get editedChannelPost(): PropOr<U, "edited_channel_post">;
|
39 | get callbackQuery(): PropOr<U, "callback_query">;
|
40 | get poll(): PropOr<U, "poll">;
|
41 | get pollAnswer(): PropOr<U, "poll_answer">;
|
42 | get myChatMember(): PropOr<U, "my_chat_member">;
|
43 | get chatMember(): PropOr<U, "chat_member">;
|
44 | get chatJoinRequest(): PropOr<U, "chat_join_request">;
|
45 | get chat(): Getter<U, 'chat'>;
|
46 | get senderChat(): PropOr<GetUpdateContent<U>, "sender_chat", undefined>;
|
47 | get from(): PropOr<GetUpdateContent<U>, "from", undefined>;
|
48 | get inlineMessageId(): string | undefined;
|
49 | get passportData(): tg.PassportData | undefined;
|
50 | get webAppData(): {
|
51 | data: {
|
52 | json<T>(): T;
|
53 | text(): string;
|
54 | };
|
55 | button_text: string;
|
56 | } | undefined;
|
57 | /**
|
58 | * @deprecated use {@link Telegram.webhookReply}
|
59 | */
|
60 | get webhookReply(): boolean;
|
61 | set webhookReply(enable: boolean);
|
62 | has<Filter extends tt.UpdateType | Guard<Context['update']>>(filters: MaybeArray<Filter>): this is FilteredContext<Context, Filter>;
|
63 | /**
|
64 | * @see https://core.telegram.org/bots/api#answerinlinequery
|
65 | */
|
66 | answerInlineQuery(...args: Shorthand<'answerInlineQuery'>): Promise<true>;
|
67 | /**
|
68 | * @see https://core.telegram.org/bots/api#answercallbackquery
|
69 | */
|
70 | answerCbQuery(...args: Shorthand<'answerCbQuery'>): Promise<true>;
|
71 | /**
|
72 | * @see https://core.telegram.org/bots/api#answercallbackquery
|
73 | */
|
74 | answerGameQuery(...args: Shorthand<'answerGameQuery'>): Promise<true>;
|
75 | /**
|
76 | * @see https://core.telegram.org/bots/api#answershippingquery
|
77 | */
|
78 | answerShippingQuery(...args: Shorthand<'answerShippingQuery'>): Promise<true>;
|
79 | /**
|
80 | * @see https://core.telegram.org/bots/api#answerprecheckoutquery
|
81 | */
|
82 | answerPreCheckoutQuery(...args: Shorthand<'answerPreCheckoutQuery'>): Promise<true>;
|
83 | /**
|
84 | * @see https://core.telegram.org/bots/api#editmessagetext
|
85 | */
|
86 | editMessageText(text: string | FmtString, extra?: tt.ExtraEditMessageText): Promise<true | (tg.Update.Edited & tg.Message.TextMessage)>;
|
87 | /**
|
88 | * @see https://core.telegram.org/bots/api#editmessagecaption
|
89 | */
|
90 | editMessageCaption(caption: string | FmtString | undefined, extra?: tt.ExtraEditMessageCaption): Promise<true | (tg.Update.Edited & tg.Message.CaptionableMessage)>;
|
91 | /**
|
92 | * @see https://core.telegram.org/bots/api#editmessagemedia
|
93 | */
|
94 | editMessageMedia(media: tt.WrapCaption<tg.InputMedia>, extra?: tt.ExtraEditMessageMedia): Promise<true | (tg.Update.Edited & tg.Message)>;
|
95 | /**
|
96 | * @see https://core.telegram.org/bots/api#editmessagereplymarkup
|
97 | */
|
98 | editMessageReplyMarkup(markup: tg.InlineKeyboardMarkup | undefined): Promise<true | (tg.Update.Edited & tg.Message)>;
|
99 | /**
|
100 | * @see https://core.telegram.org/bots/api#editmessagelivelocation
|
101 | */
|
102 | editMessageLiveLocation(latitude: number, longitude: number, extra?: tt.ExtraEditMessageLiveLocation): Promise<true | (tg.Update.Edited & tg.Message.LocationMessage)>;
|
103 | /**
|
104 | * @see https://core.telegram.org/bots/api#stopmessagelivelocation
|
105 | */
|
106 | stopMessageLiveLocation(markup?: tg.InlineKeyboardMarkup): Promise<true | (tg.Update.Edited & tg.Message.LocationMessage)>;
|
107 | /**
|
108 | * @see https://core.telegram.org/bots/api#sendmessage
|
109 | */
|
110 | sendMessage(text: string | FmtString, extra?: tt.ExtraReplyMessage): Promise<tg.Message.TextMessage>;
|
111 | /**
|
112 | * @see https://core.telegram.org/bots/api#sendmessage
|
113 | */
|
114 | reply(...args: Shorthand<'sendMessage'>): Promise<tg.Message.TextMessage>;
|
115 | /**
|
116 | * @see https://core.telegram.org/bots/api#getchat
|
117 | */
|
118 | getChat(...args: Shorthand<'getChat'>): Promise<tg.ChatFromGetChat>;
|
119 | /**
|
120 | * @see https://core.telegram.org/bots/api#exportchatinvitelink
|
121 | */
|
122 | exportChatInviteLink(...args: Shorthand<'exportChatInviteLink'>): Promise<string>;
|
123 | /**
|
124 | * @see https://core.telegram.org/bots/api#createchatinvitelink
|
125 | */
|
126 | createChatInviteLink(...args: Shorthand<'createChatInviteLink'>): Promise<tg.ChatInviteLink>;
|
127 | /**
|
128 | * @see https://core.telegram.org/bots/api#editchatinvitelink
|
129 | */
|
130 | editChatInviteLink(...args: Shorthand<'editChatInviteLink'>): Promise<tg.ChatInviteLink>;
|
131 | /**
|
132 | * @see https://core.telegram.org/bots/api#revokechatinvitelink
|
133 | */
|
134 | revokeChatInviteLink(...args: Shorthand<'revokeChatInviteLink'>): Promise<tg.ChatInviteLink>;
|
135 | /**
|
136 | * @see https://core.telegram.org/bots/api#banchatmember
|
137 | */
|
138 | banChatMember(...args: Shorthand<'banChatMember'>): Promise<true>;
|
139 | /**
|
140 | * @see https://core.telegram.org/bots/api#banchatmember
|
141 | * @deprecated since API 5.3. Use {@link Context.banChatMember}
|
142 | */
|
143 | get kickChatMember(): (userId: number, untilDate?: number | undefined, extra?: Omit<{
|
144 | chat_id: string | number;
|
145 | user_id: number;
|
146 | until_date?: number | undefined;
|
147 | revoke_messages?: boolean | undefined;
|
148 | }, "chat_id" | "user_id" | "until_date"> | undefined) => Promise<true>;
|
149 | /**
|
150 | * @see https://core.telegram.org/bots/api#unbanchatmember
|
151 | */
|
152 | unbanChatMember(...args: Shorthand<'unbanChatMember'>): Promise<true>;
|
153 | /**
|
154 | * @see https://core.telegram.org/bots/api#restrictchatmember
|
155 | */
|
156 | restrictChatMember(...args: Shorthand<'restrictChatMember'>): Promise<true>;
|
157 | /**
|
158 | * @see https://core.telegram.org/bots/api#promotechatmember
|
159 | */
|
160 | promoteChatMember(...args: Shorthand<'promoteChatMember'>): Promise<true>;
|
161 | /**
|
162 | * @see https://core.telegram.org/bots/api#setchatadministratorcustomtitle
|
163 | */
|
164 | setChatAdministratorCustomTitle(...args: Shorthand<'setChatAdministratorCustomTitle'>): Promise<true>;
|
165 | /**
|
166 | * @see https://core.telegram.org/bots/api#setchatphoto
|
167 | */
|
168 | setChatPhoto(...args: Shorthand<'setChatPhoto'>): Promise<true>;
|
169 | /**
|
170 | * @see https://core.telegram.org/bots/api#deletechatphoto
|
171 | */
|
172 | deleteChatPhoto(...args: Shorthand<'deleteChatPhoto'>): Promise<true>;
|
173 | /**
|
174 | * @see https://core.telegram.org/bots/api#setchattitle
|
175 | */
|
176 | setChatTitle(...args: Shorthand<'setChatTitle'>): Promise<true>;
|
177 | /**
|
178 | * @see https://core.telegram.org/bots/api#setchatdescription
|
179 | */
|
180 | setChatDescription(...args: Shorthand<'setChatDescription'>): Promise<true>;
|
181 | /**
|
182 | * @see https://core.telegram.org/bots/api#pinchatmessage
|
183 | */
|
184 | pinChatMessage(...args: Shorthand<'pinChatMessage'>): Promise<true>;
|
185 | /**
|
186 | * @see https://core.telegram.org/bots/api#unpinchatmessage
|
187 | */
|
188 | unpinChatMessage(...args: Shorthand<'unpinChatMessage'>): Promise<true>;
|
189 | /**
|
190 | * @see https://core.telegram.org/bots/api#unpinallchatmessages
|
191 | */
|
192 | unpinAllChatMessages(...args: Shorthand<'unpinAllChatMessages'>): Promise<true>;
|
193 | /**
|
194 | * @see https://core.telegram.org/bots/api#leavechat
|
195 | */
|
196 | leaveChat(...args: Shorthand<'leaveChat'>): Promise<true>;
|
197 | /**
|
198 | * @see https://core.telegram.org/bots/api#setchatpermissions
|
199 | */
|
200 | setChatPermissions(...args: Shorthand<'setChatPermissions'>): Promise<true>;
|
201 | /**
|
202 | * @see https://core.telegram.org/bots/api#getchatadministrators
|
203 | */
|
204 | getChatAdministrators(...args: Shorthand<'getChatAdministrators'>): Promise<(tg.ChatMemberOwner | tg.ChatMemberAdministrator)[]>;
|
205 | /**
|
206 | * @see https://core.telegram.org/bots/api#getchatmember
|
207 | */
|
208 | getChatMember(...args: Shorthand<'getChatMember'>): Promise<tg.ChatMember>;
|
209 | /**
|
210 | * @see https://core.telegram.org/bots/api#getchatmembercount
|
211 | */
|
212 | getChatMembersCount(...args: Shorthand<'getChatMembersCount'>): Promise<number>;
|
213 | /**
|
214 | * @see https://core.telegram.org/bots/api#setpassportdataerrors
|
215 | */
|
216 | setPassportDataErrors(errors: readonly tg.PassportElementError[]): Promise<true>;
|
217 | /**
|
218 | * @see https://core.telegram.org/bots/api#sendphoto
|
219 | */
|
220 | sendPhoto(photo: string | tg.InputFile, extra?: tt.ExtraPhoto): Promise<tg.Message.PhotoMessage>;
|
221 | /**
|
222 | * @see https://core.telegram.org/bots/api#sendphoto
|
223 | */
|
224 | replyWithPhoto(...args: Shorthand<'sendPhoto'>): Promise<tg.Message.PhotoMessage>;
|
225 | /**
|
226 | * @see https://core.telegram.org/bots/api#sendmediagroup
|
227 | */
|
228 | sendMediaGroup(media: tt.MediaGroup, extra?: tt.ExtraMediaGroup): Promise<(tg.Message.DocumentMessage | tg.Message.AudioMessage | tg.Message.PhotoMessage | tg.Message.VideoMessage)[]>;
|
229 | /**
|
230 | * @see https://core.telegram.org/bots/api#sendmediagroup
|
231 | */
|
232 | replyWithMediaGroup(...args: Shorthand<'sendMediaGroup'>): Promise<(tg.Message.DocumentMessage | tg.Message.AudioMessage | tg.Message.PhotoMessage | tg.Message.VideoMessage)[]>;
|
233 | /**
|
234 | * @see https://core.telegram.org/bots/api#sendaudio
|
235 | */
|
236 | sendAudio(audio: string | tg.InputFile, extra?: tt.ExtraAudio): Promise<tg.Message.AudioMessage>;
|
237 | /**
|
238 | * @see https://core.telegram.org/bots/api#sendaudio
|
239 | */
|
240 | replyWithAudio(...args: Shorthand<'sendAudio'>): Promise<tg.Message.AudioMessage>;
|
241 | /**
|
242 | * @see https://core.telegram.org/bots/api#senddice
|
243 | */
|
244 | sendDice(extra?: tt.ExtraDice): Promise<tg.Message.DiceMessage>;
|
245 | /**
|
246 | * @see https://core.telegram.org/bots/api#senddice
|
247 | */
|
248 | replyWithDice(...args: Shorthand<'sendDice'>): Promise<tg.Message.DiceMessage>;
|
249 | /**
|
250 | * @see https://core.telegram.org/bots/api#senddocument
|
251 | */
|
252 | sendDocument(document: string | tg.InputFile, extra?: tt.ExtraDocument): Promise<tg.Message.DocumentMessage>;
|
253 | /**
|
254 | * @see https://core.telegram.org/bots/api#senddocument
|
255 | */
|
256 | replyWithDocument(...args: Shorthand<'sendDocument'>): Promise<tg.Message.DocumentMessage>;
|
257 | /**
|
258 | * @see https://core.telegram.org/bots/api#sendsticker
|
259 | */
|
260 | sendSticker(sticker: string | tg.InputFile, extra?: tt.ExtraSticker): Promise<tg.Message.StickerMessage>;
|
261 | /**
|
262 | * @see https://core.telegram.org/bots/api#sendsticker
|
263 | */
|
264 | replyWithSticker(...args: Shorthand<'sendSticker'>): Promise<tg.Message.StickerMessage>;
|
265 | /**
|
266 | * @see https://core.telegram.org/bots/api#sendvideo
|
267 | */
|
268 | sendVideo(video: string | tg.InputFile, extra?: tt.ExtraVideo): Promise<tg.Message.VideoMessage>;
|
269 | /**
|
270 | * @see https://core.telegram.org/bots/api#sendvideo
|
271 | */
|
272 | replyWithVideo(...args: Shorthand<'sendVideo'>): Promise<tg.Message.VideoMessage>;
|
273 | /**
|
274 | * @see https://core.telegram.org/bots/api#sendanimation
|
275 | */
|
276 | sendAnimation(animation: string | tg.InputFile, extra?: tt.ExtraAnimation): Promise<tg.Message.AnimationMessage>;
|
277 | /**
|
278 | * @see https://core.telegram.org/bots/api#sendanimation
|
279 | */
|
280 | replyWithAnimation(...args: Shorthand<'sendAnimation'>): Promise<tg.Message.AnimationMessage>;
|
281 | /**
|
282 | * @see https://core.telegram.org/bots/api#sendvideonote
|
283 | */
|
284 | sendVideoNote(videoNote: string | tg.InputFileVideoNote, extra?: tt.ExtraVideoNote): Promise<tg.Message.VideoNoteMessage>;
|
285 | /**
|
286 | * @see https://core.telegram.org/bots/api#sendvideonote
|
287 | */
|
288 | replyWithVideoNote(...args: Shorthand<'sendVideoNote'>): Promise<tg.Message.VideoNoteMessage>;
|
289 | /**
|
290 | * @see https://core.telegram.org/bots/api#sendinvoice
|
291 | */
|
292 | sendInvoice(invoice: tt.NewInvoiceParameters, extra?: tt.ExtraInvoice): Promise<tg.Message.InvoiceMessage>;
|
293 | /**
|
294 | * @see https://core.telegram.org/bots/api#sendinvoice
|
295 | */
|
296 | replyWithInvoice(...args: Shorthand<'sendInvoice'>): Promise<tg.Message.InvoiceMessage>;
|
297 | /**
|
298 | * @see https://core.telegram.org/bots/api#sendgame
|
299 | */
|
300 | sendGame(game: string, extra?: tt.ExtraGame): Promise<tg.Message.GameMessage>;
|
301 | /**
|
302 | * @see https://core.telegram.org/bots/api#sendgame
|
303 | */
|
304 | replyWithGame(...args: Shorthand<'sendGame'>): Promise<tg.Message.GameMessage>;
|
305 | /**
|
306 | * @see https://core.telegram.org/bots/api#sendvoice
|
307 | */
|
308 | sendVoice(voice: string | tg.InputFile, extra?: tt.ExtraVoice): Promise<tg.Message.VoiceMessage>;
|
309 | /**
|
310 | * @see https://core.telegram.org/bots/api#sendvoice
|
311 | */
|
312 | replyWithVoice(...args: Shorthand<'sendVoice'>): Promise<tg.Message.VoiceMessage>;
|
313 | /**
|
314 | * @see https://core.telegram.org/bots/api#sendpoll
|
315 | */
|
316 | sendPoll(poll: string, options: readonly string[], extra?: tt.ExtraPoll): Promise<tg.Message.PollMessage>;
|
317 | /**
|
318 | * @see https://core.telegram.org/bots/api#sendpoll
|
319 | */
|
320 | replyWithPoll(...args: Shorthand<'sendPoll'>): Promise<tg.Message.PollMessage>;
|
321 | /**
|
322 | * @see https://core.telegram.org/bots/api#sendpoll
|
323 | */
|
324 | sendQuiz(quiz: string, options: readonly string[], extra?: tt.ExtraPoll): Promise<tg.Message.PollMessage>;
|
325 | /**
|
326 | * @see https://core.telegram.org/bots/api#sendpoll
|
327 | */
|
328 | replyWithQuiz(...args: Shorthand<'sendQuiz'>): Promise<tg.Message.PollMessage>;
|
329 | /**
|
330 | * @see https://core.telegram.org/bots/api#stoppoll
|
331 | */
|
332 | stopPoll(...args: Shorthand<'stopPoll'>): Promise<tg.Poll>;
|
333 | /**
|
334 | * @see https://core.telegram.org/bots/api#sendchataction
|
335 | */
|
336 | sendChatAction(action: Shorthand<'sendChatAction'>[0], extra?: tt.ExtraSendChatAction): Promise<true>;
|
337 | /**
|
338 | * @see https://core.telegram.org/bots/api#sendchataction
|
339 | *
|
340 | * Sends the sendChatAction request repeatedly, with a delay between requests,
|
341 | * as long as the provided callback function is being processed.
|
342 | *
|
343 | * The sendChatAction errors should be ignored, because the goal is the actual long process completing and performing an action.
|
344 | *
|
345 | * @param action - chat action type.
|
346 | * @param callback - a function to run along with the chat action.
|
347 | * @param extra - extra parameters for sendChatAction.
|
348 | * @param {number} [extra.intervalDuration=8000] - The duration (in milliseconds) between subsequent sendChatAction requests.
|
349 | */
|
350 | persistentChatAction(action: Shorthand<'sendChatAction'>[0], callback: () => Promise<void>, { intervalDuration, ...extra }?: tt.ExtraSendChatAction & {
|
351 | intervalDuration?: number;
|
352 | }): Promise<void>;
|
353 | /**
|
354 | * @deprecated use {@link Context.sendChatAction} instead
|
355 | * @see https://core.telegram.org/bots/api#sendchataction
|
356 | */
|
357 | replyWithChatAction(...args: Shorthand<'sendChatAction'>): Promise<true>;
|
358 | /**
|
359 | * @see https://core.telegram.org/bots/api#sendlocation
|
360 | */
|
361 | sendLocation(latitude: number, longitude: number, extra?: tt.ExtraLocation): Promise<tg.Message.LocationMessage>;
|
362 | /**
|
363 | * @see https://core.telegram.org/bots/api#sendlocation
|
364 | */
|
365 | replyWithLocation(...args: Shorthand<'sendLocation'>): Promise<tg.Message.LocationMessage>;
|
366 | /**
|
367 | * @see https://core.telegram.org/bots/api#sendvenue
|
368 | */
|
369 | sendVenue(latitude: number, longitude: number, title: string, address: string, extra?: tt.ExtraVenue): Promise<tg.Message.VenueMessage>;
|
370 | /**
|
371 | * @see https://core.telegram.org/bots/api#sendvenue
|
372 | */
|
373 | replyWithVenue(...args: Shorthand<'sendVenue'>): Promise<tg.Message.VenueMessage>;
|
374 | /**
|
375 | * @see https://core.telegram.org/bots/api#sendcontact
|
376 | */
|
377 | sendContact(phoneNumber: string, firstName: string, extra?: tt.ExtraContact): Promise<tg.Message.ContactMessage>;
|
378 | /**
|
379 | * @see https://core.telegram.org/bots/api#sendcontact
|
380 | */
|
381 | replyWithContact(...args: Shorthand<'sendContact'>): Promise<tg.Message.ContactMessage>;
|
382 | /**
|
383 | * @deprecated use {@link Telegram.getStickerSet}
|
384 | * @see https://core.telegram.org/bots/api#getstickerset
|
385 | */
|
386 | getStickerSet(setName: string): Promise<tg.StickerSet>;
|
387 | /**
|
388 | * @see https://core.telegram.org/bots/api#setchatstickerset
|
389 | */
|
390 | setChatStickerSet(setName: string): Promise<true>;
|
391 | /**
|
392 | * @see https://core.telegram.org/bots/api#deletechatstickerset
|
393 | */
|
394 | deleteChatStickerSet(): Promise<true>;
|
395 | /**
|
396 | * Use this method to create a topic in a forum supergroup chat. The bot must be an administrator in the chat for this
|
397 | * to work and must have the can_manage_topics administrator rights. Returns information about the created topic as a
|
398 | * ForumTopic object.
|
399 | *
|
400 | * @see https://core.telegram.org/bots/api#createforumtopic
|
401 | */
|
402 | createForumTopic(...args: Shorthand<'createForumTopic'>): Promise<tg.ForumTopic>;
|
403 | /**
|
404 | * Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in
|
405 | * the chat for this to work and must have can_manage_topics administrator rights, unless it is the creator of the
|
406 | * topic. Returns True on success.
|
407 | *
|
408 | * @see https://core.telegram.org/bots/api#editforumtopic
|
409 | */
|
410 | editForumTopic(extra: tt.ExtraEditForumTopic): Promise<true>;
|
411 | /**
|
412 | * Use this method to close an open topic in a forum supergroup chat. The bot must be an administrator in the chat
|
413 | * for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic.
|
414 | * Returns True on success.
|
415 | *
|
416 | * @see https://core.telegram.org/bots/api#closeforumtopic
|
417 | */
|
418 | closeForumTopic(): Promise<true>;
|
419 | /**
|
420 | * Use this method to reopen a closed topic in a forum supergroup chat. The bot must be an administrator in the chat
|
421 | * for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic.
|
422 | * Returns True on success.
|
423 | *
|
424 | * @see https://core.telegram.org/bots/api#reopenforumtopic
|
425 | */
|
426 | reopenForumTopic(): Promise<true>;
|
427 | /**
|
428 | * Use this method to delete a forum topic along with all its messages in a forum supergroup chat. The bot must be an
|
429 | * administrator in the chat for this to work and must have the can_delete_messages administrator rights.
|
430 | * Returns True on success.
|
431 | *
|
432 | * @see https://core.telegram.org/bots/api#deleteforumtopic
|
433 | */
|
434 | deleteForumTopic(): Promise<true>;
|
435 | /**
|
436 | * Use this method to clear the list of pinned messages in a forum topic. The bot must be an administrator in the chat
|
437 | * for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success.
|
438 | *
|
439 | * @see https://core.telegram.org/bots/api#unpinallforumtopicmessages
|
440 | */
|
441 | unpinAllForumTopicMessages(): Promise<true>;
|
442 | /**
|
443 | * Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator
|
444 | * in the chat for this to work and must have can_manage_topics administrator rights. Returns True on success.
|
445 | *
|
446 | * @see https://core.telegram.org/bots/api#editgeneralforumtopic
|
447 | */
|
448 | editGeneralForumTopic(name: string): Promise<true>;
|
449 | /**
|
450 | * Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the
|
451 | * chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.
|
452 | *
|
453 | * @see https://core.telegram.org/bots/api#closegeneralforumtopic
|
454 | */
|
455 | closeGeneralForumTopic(): Promise<true>;
|
456 | /**
|
457 | * Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in
|
458 | * the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically
|
459 | * unhidden if it was hidden. Returns True on success.
|
460 | *
|
461 | * @see https://core.telegram.org/bots/api#reopengeneralforumtopic
|
462 | */
|
463 | reopenGeneralForumTopic(): Promise<true>;
|
464 | /**
|
465 | * Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat
|
466 | * for this to work and must have the can_manage_topics administrator rights. The topic will be automatically closed
|
467 | * if it was open. Returns True on success.
|
468 | *
|
469 | * @see https://core.telegram.org/bots/api#hidegeneralforumtopic
|
470 | */
|
471 | hideGeneralForumTopic(): Promise<true>;
|
472 | /**
|
473 | * Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the
|
474 | * chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.
|
475 | *
|
476 | * @see https://core.telegram.org/bots/api#unhidegeneralforumtopic
|
477 | */
|
478 | unhideGeneralForumTopic(): Promise<true>;
|
479 | /**
|
480 | * Use this method to clear the list of pinned messages in a General forum topic.
|
481 | * The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator
|
482 | * right in the supergroup.
|
483 | *
|
484 | * @param chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
|
485 | *
|
486 | * @see https://core.telegram.org/bots/api#unpinallgeneralforumtopicmessages
|
487 | */
|
488 | unpinAllGeneralForumTopicMessages(): Promise<true>;
|
489 | /**
|
490 | * @deprecated use {@link Telegram.setStickerPositionInSet}
|
491 | * @see https://core.telegram.org/bots/api#setstickerpositioninset
|
492 | */
|
493 | setStickerPositionInSet(sticker: string, position: number): Promise<true>;
|
494 | /**
|
495 | * @deprecated use {@link Telegram.setStickerSetThumbnail}
|
496 | * @see https://core.telegram.org/bots/api#setstickersetthumbnail
|
497 | */
|
498 | setStickerSetThumb(...args: Parameters<Telegram['setStickerSetThumbnail']>): Promise<true>;
|
499 | setStickerSetThumbnail(...args: Parameters<Telegram['setStickerSetThumbnail']>): Promise<true>;
|
500 | setStickerMaskPosition(...args: Parameters<Telegram['setStickerMaskPosition']>): Promise<true>;
|
501 | setStickerKeywords(...args: Parameters<Telegram['setStickerKeywords']>): Promise<true>;
|
502 | setStickerEmojiList(...args: Parameters<Telegram['setStickerEmojiList']>): Promise<true>;
|
503 | deleteStickerSet(...args: Parameters<Telegram['deleteStickerSet']>): Promise<true>;
|
504 | setStickerSetTitle(...args: Parameters<Telegram['setStickerSetTitle']>): Promise<true>;
|
505 | setCustomEmojiStickerSetThumbnail(...args: Parameters<Telegram['setCustomEmojiStickerSetThumbnail']>): Promise<true>;
|
506 | /**
|
507 | * @deprecated use {@link Telegram.deleteStickerFromSet}
|
508 | * @see https://core.telegram.org/bots/api#deletestickerfromset
|
509 | */
|
510 | deleteStickerFromSet(sticker: string): Promise<true>;
|
511 | /**
|
512 | * @see https://core.telegram.org/bots/api#uploadstickerfile
|
513 | */
|
514 | uploadStickerFile(...args: Shorthand<'uploadStickerFile'>): Promise<tg.File>;
|
515 | /**
|
516 | * @see https://core.telegram.org/bots/api#createnewstickerset
|
517 | */
|
518 | createNewStickerSet(...args: Shorthand<'createNewStickerSet'>): Promise<true>;
|
519 | /**
|
520 | * @see https://core.telegram.org/bots/api#addstickertoset
|
521 | */
|
522 | addStickerToSet(...args: Shorthand<'addStickerToSet'>): Promise<true>;
|
523 | /**
|
524 | * @deprecated use {@link Telegram.getMyCommands}
|
525 | * @see https://core.telegram.org/bots/api#getmycommands
|
526 | */
|
527 | getMyCommands(): Promise<tg.BotCommand[]>;
|
528 | /**
|
529 | * @deprecated use {@link Telegram.setMyCommands}
|
530 | * @see https://core.telegram.org/bots/api#setmycommands
|
531 | */
|
532 | setMyCommands(commands: readonly tg.BotCommand[]): Promise<true>;
|
533 | /**
|
534 | * @deprecated use {@link Context.replyWithMarkdownV2}
|
535 | * @see https://core.telegram.org/bots/api#sendmessage
|
536 | */
|
537 | replyWithMarkdown(markdown: string, extra?: tt.ExtraReplyMessage): Promise<tg.Message.TextMessage>;
|
538 | /**
|
539 | * @see https://core.telegram.org/bots/api#sendmessage
|
540 | */
|
541 | replyWithMarkdownV2(markdown: string, extra?: tt.ExtraReplyMessage): Promise<tg.Message.TextMessage>;
|
542 | /**
|
543 | * @see https://core.telegram.org/bots/api#sendmessage
|
544 | */
|
545 | replyWithHTML(html: string, extra?: tt.ExtraReplyMessage): Promise<tg.Message.TextMessage>;
|
546 | /**
|
547 | * @see https://core.telegram.org/bots/api#deletemessage
|
548 | */
|
549 | deleteMessage(messageId?: number): Promise<true>;
|
550 | /**
|
551 | * @see https://core.telegram.org/bots/api#forwardmessage
|
552 | */
|
553 | forwardMessage(chatId: string | number, extra?: Shorthand<'forwardMessage'>[2]): Promise<tg.Message>;
|
554 | /**
|
555 | * @see https://core.telegram.org/bots/api#copymessage
|
556 | */
|
557 | copyMessage(chatId: string | number, extra?: tt.ExtraCopyMessage): Promise<tg.MessageId>;
|
558 | /**
|
559 | * @see https://core.telegram.org/bots/api#approvechatjoinrequest
|
560 | */
|
561 | approveChatJoinRequest(userId: number): Promise<true>;
|
562 | /**
|
563 | * @see https://core.telegram.org/bots/api#declinechatjoinrequest
|
564 | */
|
565 | declineChatJoinRequest(userId: number): Promise<true>;
|
566 | /**
|
567 | * @see https://core.telegram.org/bots/api#banchatsenderchat
|
568 | */
|
569 | banChatSenderChat(senderChatId: number): Promise<true>;
|
570 | /**
|
571 | * @see https://core.telegram.org/bots/api#unbanchatsenderchat
|
572 | */
|
573 | unbanChatSenderChat(senderChatId: number): Promise<true>;
|
574 | /**
|
575 | * Use this method to change the bot's menu button in the current private chat. Returns true on success.
|
576 | * @see https://core.telegram.org/bots/api#setchatmenubutton
|
577 | */
|
578 | setChatMenuButton(menuButton?: tg.MenuButton): Promise<true>;
|
579 | /**
|
580 | * Use this method to get the current value of the bot's menu button in the current private chat. Returns MenuButton on success.
|
581 | * @see https://core.telegram.org/bots/api#getchatmenubutton
|
582 | */
|
583 | getChatMenuButton(): Promise<tg.MenuButton>;
|
584 | /**
|
585 | * @see https://core.telegram.org/bots/api#setmydefaultadministratorrights
|
586 | */
|
587 | setMyDefaultAdministratorRights(extra?: Parameters<Telegram['setMyDefaultAdministratorRights']>[0]): Promise<true>;
|
588 | /**
|
589 | * @see https://core.telegram.org/bots/api#getmydefaultadministratorrights
|
590 | */
|
591 | getMyDefaultAdministratorRights(extra?: Parameters<Telegram['getMyDefaultAdministratorRights']>[0]): Promise<tg.ChatAdministratorRights>;
|
592 | }
|
593 | export default Context;
|
594 | type UpdateTypes<U extends Deunionize<tg.Update>> = Extract<UnionKeys<U>, tt.UpdateType>;
|
595 | export type GetUpdateContent<U extends tg.Update> = U extends tg.Update.CallbackQueryUpdate ? U['callback_query']['message'] : U[UpdateTypes<U>];
|
596 | type Getter<U extends Deunionize<tg.Update>, P extends string> = PropOr<GetUpdateContent<U>, P>;
|
597 | //# sourceMappingURL=context.d.ts.map |
\ | No newline at end of file |