UNPKG

45.6 kBTypeScriptView Raw
1/// <reference types="node" />
2import * as tg from './core/types/typegram';
3import * as tt from './telegram-types';
4import ApiClient from './core/network/client';
5import { URL } from 'url';
6import { FmtString } from './format';
7export declare class Telegram extends ApiClient {
8 /**
9 * Get basic information about the bot
10 */
11 getMe(): Promise<tg.UserFromGetMe>;
12 /**
13 * Get basic info about a file and prepare it for downloading.
14 * @param fileId Id of file to get link to
15 */
16 getFile(fileId: string): Promise<tg.File>;
17 /**
18 * Get download link to a file.
19 */
20 getFileLink(fileId: string | tg.File): Promise<URL>;
21 /**
22 * Directly request incoming updates.
23 * You should probably use `Telegraf::launch` instead.
24 */
25 getUpdates(timeout: number, limit: number, offset: number, allowedUpdates: readonly tt.UpdateType[] | undefined): Promise<tg.Update[]>;
26 getWebhookInfo(): Promise<tg.WebhookInfo>;
27 getGameHighScores(userId: number, inlineMessageId: string | undefined, chatId: number | undefined, messageId: number | undefined): Promise<tg.GameHighScore[]>;
28 setGameScore(userId: number, score: number, inlineMessageId: string | undefined, chatId: number | undefined, messageId: number | undefined, editMessage?: boolean, force?: boolean): Promise<true | (tg.Update.Edited & tg.Message.GameMessage)>;
29 /**
30 * Specify a url to receive incoming updates via an outgoing webhook.
31 * @param url HTTPS url to send updates to. Use an empty string to remove webhook integration
32 */
33 setWebhook(url: string, extra?: tt.ExtraSetWebhook): Promise<true>;
34 /**
35 * Remove webhook integration.
36 */
37 deleteWebhook(extra?: {
38 drop_pending_updates?: boolean;
39 }): Promise<true>;
40 /**
41 * Send a text message.
42 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
43 * @param text Text of the message to be sent
44 */
45 sendMessage(chatId: number | string, text: string | FmtString, extra?: tt.ExtraReplyMessage): Promise<tg.Message.TextMessage>;
46 /**
47 * Forward existing message.
48 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
49 * @param fromChatId Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
50 * @param messageId Message identifier in the chat specified in from_chat_id
51 */
52 forwardMessage(chatId: number | string, fromChatId: number | string, messageId: number, extra?: tt.ExtraForwardMessage): Promise<tg.Message>;
53 /**
54 * Use this method when you need to tell the user that something is happening on the bot's side.
55 * The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status).
56 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
57 */
58 sendChatAction(chat_id: number | string, action: tt.ChatAction, extra?: tt.ExtraSendChatAction): Promise<true>;
59 getUserProfilePhotos(userId: number, offset?: number, limit?: number): Promise<tg.UserProfilePhotos>;
60 /**
61 * Send point on the map.
62 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
63 */
64 sendLocation(chatId: number | string, latitude: number, longitude: number, extra?: tt.ExtraLocation): Promise<tg.Message.LocationMessage>;
65 sendVenue(chatId: number | string, latitude: number, longitude: number, title: string, address: string, extra?: tt.ExtraVenue): Promise<tg.Message.VenueMessage>;
66 /**
67 * @param chatId Unique identifier for the target private chat
68 */
69 sendInvoice(chatId: number | string, invoice: tt.NewInvoiceParameters, extra?: tt.ExtraInvoice): Promise<tg.Message.InvoiceMessage>;
70 sendContact(chatId: number | string, phoneNumber: string, firstName: string, extra?: tt.ExtraContact): Promise<tg.Message.ContactMessage>;
71 /**
72 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
73 */
74 sendPhoto(chatId: number | string, photo: tg.Opts<'sendPhoto'>['photo'], extra?: tt.ExtraPhoto): Promise<tg.Message.PhotoMessage>;
75 /**
76 * Send a dice, which will have a random value from 1 to 6.
77 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
78 */
79 sendDice(chatId: number | string, extra?: tt.ExtraDice): Promise<tg.Message.DiceMessage>;
80 /**
81 * Send general files. Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.
82 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
83 */
84 sendDocument(chatId: number | string, document: tg.Opts<'sendDocument'>['document'], extra?: tt.ExtraDocument): Promise<tg.Message.DocumentMessage>;
85 /**
86 * Send audio files, if you want Telegram clients to display them in the music player.
87 * Your audio must be in the .mp3 format.
88 * Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.
89 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
90 */
91 sendAudio(chatId: number | string, audio: tg.Opts<'sendAudio'>['audio'], extra?: tt.ExtraAudio): Promise<tg.Message.AudioMessage>;
92 /**
93 * Send .webp, animated .tgs, or video .webm stickers
94 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
95 */
96 sendSticker(chatId: number | string, sticker: tg.Opts<'sendSticker'>['sticker'], extra?: tt.ExtraSticker): Promise<tg.Message.StickerMessage>;
97 /**
98 * Send video files, Telegram clients support mp4 videos (other formats may be sent as Document).
99 * Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.
100 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
101 */
102 sendVideo(chatId: number | string, video: tg.Opts<'sendVideo'>['video'], extra?: tt.ExtraVideo): Promise<tg.Message.VideoMessage>;
103 /**
104 * Send .gif animations.
105 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
106 */
107 sendAnimation(chatId: number | string, animation: tg.Opts<'sendAnimation'>['animation'], extra?: tt.ExtraAnimation): Promise<tg.Message.AnimationMessage>;
108 /**
109 * Send video messages.
110 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
111 */
112 sendVideoNote(chatId: number | string, videoNote: string | tg.InputFileVideoNote, extra?: tt.ExtraVideoNote): Promise<tg.Message.VideoNoteMessage>;
113 /**
114 * Send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .ogg file encoded with OPUS (other formats may be sent as Audio or Document). On success, the sent Message is returned. Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.
115 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
116 */
117 sendVoice(chatId: number | string, voice: tg.Opts<'sendVoice'>['voice'], extra?: tt.ExtraVoice): Promise<tg.Message.VoiceMessage>;
118 /**
119 * @param chatId Unique identifier for the target chat
120 * @param gameShortName Short name of the game, serves as the unique identifier for the game. Set up your games via Botfather.
121 */
122 sendGame(chatId: number, gameName: string, extra?: tt.ExtraGame): Promise<tg.Message.GameMessage>;
123 /**
124 * Send a group of photos or videos as an album.
125 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
126 * @param media A JSON-serialized array describing photos and videos to be sent, must include 2–10 items
127 */
128 sendMediaGroup(chatId: number | string, media: tt.MediaGroup, extra?: tt.ExtraMediaGroup): Promise<(tg.Message.DocumentMessage | tg.Message.AudioMessage | tg.Message.PhotoMessage | tg.Message.VideoMessage)[]>;
129 /**
130 * Send a native poll.
131 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
132 * @param question Poll question, 1-255 characters
133 * @param options A JSON-serialized list of answer options, 2-10 strings 1-100 characters each
134 */
135 sendPoll(chatId: number | string, question: string, options: readonly string[], extra?: tt.ExtraPoll): Promise<tg.Message.PollMessage>;
136 /**
137 * Send a native quiz.
138 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
139 * @param question Poll question, 1-255 characters
140 * @param options A JSON-serialized list of answer options, 2-10 strings 1-100 characters each
141 */
142 sendQuiz(chatId: number | string, question: string, options: readonly string[], extra: tt.ExtraPoll): Promise<tg.Message.PollMessage>;
143 /**
144 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
145 * @param messageId Identifier of the original message with the poll
146 */
147 stopPoll(chatId: number | string, messageId: number, extra?: tt.ExtraStopPoll): Promise<tg.Poll>;
148 /**
149 * Get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.).
150 * @param chatId Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
151 */
152 getChat(chatId: number | string): Promise<tg.ChatFromGetChat>;
153 /**
154 * @param chatId Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
155 */
156 getChatAdministrators(chatId: number | string): Promise<(tg.ChatMemberOwner | tg.ChatMemberAdministrator)[]>;
157 /**
158 * Get information about a member of a chat.
159 * @param chatId Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
160 * @param userId Unique identifier of the target user
161 */
162 getChatMember(chatId: string | number, userId: number): Promise<tg.ChatMember>;
163 /**
164 * Get the number of members in a chat.
165 * @param chatId Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
166 */
167 getChatMembersCount(chatId: string | number): Promise<number>;
168 /**
169 * Send answers to an inline query.
170 * No more than 50 results per query are allowed.
171 */
172 answerInlineQuery(inlineQueryId: string, results: readonly tg.InlineQueryResult[], extra?: tt.ExtraAnswerInlineQuery): Promise<true>;
173 setChatPermissions(chatId: number | string, permissions: tg.ChatPermissions, extra?: tt.ExtraSetChatPermissions): Promise<true>;
174 /**
175 * Kick a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
176 * @param chatId Unique identifier for the target group or username of the target supergroup or channel (in the format `@channelusername`)
177 * @param untilDate Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever
178 */
179 banChatMember(chatId: number | string, userId: number, untilDate?: number, extra?: tt.ExtraBanChatMember): Promise<true>;
180 /**
181 * Kick a user from a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
182 * @param chatId Unique identifier for the target group or username of the target supergroup or channel (in the format `@channelusername`)
183 * @param untilDate Date when the user will be unbanned, unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever
184 * @deprecated since API 5.3. Use {@link Telegram.banChatMember}
185 */
186 get kickChatMember(): (chatId: string | number, userId: number, untilDate?: number | undefined, extra?: Omit<{
187 chat_id: string | number;
188 user_id: number;
189 until_date?: number | undefined;
190 revoke_messages?: boolean | undefined;
191 }, "chat_id" | "user_id" | "until_date"> | undefined) => Promise<true>;
192 /**
193 * Promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Pass False for all boolean parameters to demote a user.
194 * @param chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
195 */
196 promoteChatMember(chatId: number | string, userId: number, extra: tt.ExtraPromoteChatMember): Promise<true>;
197 /**
198 * Restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate admin rights. Pass True for all boolean parameters to lift restrictions from a user.
199 * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
200 */
201 restrictChatMember(chatId: string | number, userId: number, extra: tt.ExtraRestrictChatMember): Promise<true>;
202 setChatAdministratorCustomTitle(chatId: number | string, userId: number, title: string): Promise<true>;
203 /**
204 * Export an invite link to a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
205 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
206 */
207 exportChatInviteLink(chatId: number | string): Promise<string>;
208 createChatInviteLink(chatId: number | string, extra?: tt.ExtraCreateChatInviteLink): Promise<tg.ChatInviteLink>;
209 createInvoiceLink(invoice: tt.NewInvoiceLinkParameters): Promise<string>;
210 editChatInviteLink(chatId: number | string, inviteLink: string, extra?: tt.ExtraEditChatInviteLink): Promise<tg.ChatInviteLink>;
211 revokeChatInviteLink(chatId: number | string, inviteLink: string): Promise<tg.ChatInviteLink>;
212 setChatPhoto(chatId: number | string, photo: tg.Opts<'setChatPhoto'>['photo']): Promise<true>;
213 deleteChatPhoto(chatId: number | string): Promise<true>;
214 /**
215 * Change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
216 * @param chatId Unique identifier for the target group or username of the target supergroup or channel (in the format `@channelusername`)
217 * @param title New chat title, 1-255 characters
218 */
219 setChatTitle(chatId: number | string, title: string): Promise<true>;
220 setChatDescription(chatId: number | string, description?: string): Promise<true>;
221 /**
222 * Pin a message in a group, a supergroup, or a channel. The bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in the supergroup or 'can_edit_messages' admin right in the channel.
223 * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
224 */
225 pinChatMessage(chatId: number | string, messageId: number, extra?: {
226 disable_notification?: boolean;
227 }): Promise<true>;
228 /**
229 * Unpin a message in a group, a supergroup, or a channel. The bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' admin right in the supergroup or 'can_edit_messages' admin right in the channel.
230 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
231 */
232 unpinChatMessage(chatId: number | string, messageId?: number): Promise<true>;
233 /**
234 * Clear the list of pinned messages in a chat.
235 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
236 */
237 unpinAllChatMessages(chatId: number | string): Promise<true>;
238 /**
239 * Use this method for your bot to leave a group, supergroup or channel.
240 * @param chatId Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
241 */
242 leaveChat(chatId: number | string): Promise<true>;
243 /**
244 * Unban a user from a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
245 * @param chatId Unique identifier for the target group or username of the target supergroup or channel (in the format @username)
246 * @param userId Unique identifier of the target user
247 */
248 unbanChatMember(chatId: number | string, userId: number, extra?: {
249 only_if_banned?: boolean;
250 }): Promise<true>;
251 answerCbQuery(callbackQueryId: string, text?: string, extra?: tt.ExtraAnswerCbQuery): Promise<true>;
252 answerGameQuery(callbackQueryId: string, url: string): Promise<true>;
253 /**
254 * If you sent an invoice requesting a shipping address and the parameter is_flexible was specified,
255 * the Bot API will send an Update with a shipping_query field to the bot.
256 * Reply to shipping queries.
257 * @param ok Specify True if delivery to the specified address is possible and False if there are any problems (for example, if delivery to the specified address is not possible)
258 * @param shippingOptions Required if ok is True. A JSON-serialized array of available shipping options.
259 * @param errorMessage Required if ok is False. Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user.
260 */
261 answerShippingQuery(shippingQueryId: string, ok: boolean, shippingOptions: readonly tg.ShippingOption[] | undefined, errorMessage: string | undefined): Promise<true>;
262 /**
263 * Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query.
264 * Respond to such pre-checkout queries. On success, True is returned.
265 * Note: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent.
266 * @param ok Specify True if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use False if there are any problems.
267 * @param errorMessage Required if ok is False. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user.
268 */
269 answerPreCheckoutQuery(preCheckoutQueryId: string, ok: boolean, errorMessage?: string): Promise<true>;
270 answerWebAppQuery(webAppQueryId: string, result: tg.InlineQueryResult): Promise<tg.SentWebAppMessage>;
271 /**
272 * Edit text and game messages sent by the bot or via the bot (for inline bots).
273 * On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
274 * @param chatId Required if inlineMessageId is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
275 * @param messageId Required if inlineMessageId is not specified. Identifier of the sent message
276 * @param inlineMessageId Required if chatId and messageId are not specified. Identifier of the inline message
277 * @param text New text of the message
278 */
279 editMessageText(chatId: number | string | undefined, messageId: number | undefined, inlineMessageId: string | undefined, text: string | FmtString, extra?: tt.ExtraEditMessageText): Promise<true | (tg.Update.Edited & tg.Message.TextMessage)>;
280 /**
281 * Edit captions of messages sent by the bot or via the bot (for inline bots).
282 * On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
283 * @param chatId Required if inlineMessageId is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
284 * @param messageId Required if inlineMessageId is not specified. Identifier of the sent message
285 * @param inlineMessageId Required if chatId and messageId are not specified. Identifier of the inline message
286 * @param caption New caption of the message
287 * @param markup A JSON-serialized object for an inline keyboard.
288 */
289 editMessageCaption(chatId: number | string | undefined, messageId: number | undefined, inlineMessageId: string | undefined, caption: string | FmtString | undefined, extra?: tt.ExtraEditMessageCaption): Promise<true | (tg.Update.Edited & tg.Message.CaptionableMessage)>;
290 /**
291 * Edit animation, audio, document, photo, or video messages.
292 * If a message is a part of a message album, then it can be edited only to a photo or a video.
293 * Otherwise, message type can be changed arbitrarily.
294 * When inline message is edited, new file can't be uploaded.
295 * Use previously uploaded file via its file_id or specify a URL.
296 * @param chatId Required if inlineMessageId is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
297 * @param messageId Required if inlineMessageId is not specified. Identifier of the sent message
298 * @param inlineMessageId Required if chatId and messageId are not specified. Identifier of the inline message
299 * @param media New media of message
300 * @param markup Markup of inline keyboard
301 */
302 editMessageMedia(chatId: number | string | undefined, messageId: number | undefined, inlineMessageId: string | undefined, media: tt.WrapCaption<tg.InputMedia>, extra?: tt.ExtraEditMessageMedia): Promise<true | (tg.Update.Edited & tg.Message)>;
303 /**
304 * Edit only the reply markup of messages sent by the bot or via the bot (for inline bots).
305 * @param chatId Required if inlineMessageId is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
306 * @param messageId Required if inlineMessageId is not specified. Identifier of the sent message
307 * @param inlineMessageId Required if chatId and messageId are not specified. Identifier of the inline message
308 * @param markup A JSON-serialized object for an inline keyboard.
309 * @returns If edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
310 */
311 editMessageReplyMarkup(chatId: number | string | undefined, messageId: number | undefined, inlineMessageId: string | undefined, markup: tg.InlineKeyboardMarkup | undefined): Promise<true | (tg.Update.Edited & tg.Message)>;
312 editMessageLiveLocation(chatId: number | string | undefined, messageId: number | undefined, inlineMessageId: string | undefined, latitude: number, longitude: number, extra?: tt.ExtraEditMessageLiveLocation): Promise<true | (tg.Update.Edited & tg.Message.LocationMessage)>;
313 stopMessageLiveLocation(chatId: number | string | undefined, messageId: number | undefined, inlineMessageId: string | undefined, markup?: tg.InlineKeyboardMarkup): Promise<true | (tg.Update.Edited & tg.Message.LocationMessage)>;
314 /**
315 * Delete a message, including service messages, with the following limitations:
316 * - A message can only be deleted if it was sent less than 48 hours ago.
317 * - Bots can delete outgoing messages in groups and supergroups.
318 * - Bots granted can_post_messages permissions can delete outgoing messages in channels.
319 * - If the bot is an administrator of a group, it can delete any message there.
320 * - If the bot has can_delete_messages permission in a supergroup or a channel, it can delete any message there.
321 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
322 */
323 deleteMessage(chatId: number | string, messageId: number): Promise<true>;
324 setChatStickerSet(chatId: number | string, setName: string): Promise<true>;
325 deleteChatStickerSet(chatId: number | string): Promise<true>;
326 /**
327 * Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user.
328 * Requires no parameters. Returns an Array of Sticker objects.
329 *
330 * @see https://core.telegram.org/bots/api#getforumtopiciconstickers
331 */
332 getForumTopicIconStickers(): Promise<tg.Sticker[]>;
333 /**
334 * Use this method to create a topic in a forum supergroup chat. The bot must be an administrator in the chat for this
335 * to work and must have the can_manage_topics administrator rights. Returns information about the created topic as a
336 * ForumTopic object.
337 *
338 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
339 * @param name Topic name, 1-128 characters
340 *
341 * @see https://core.telegram.org/bots/api#createforumtopic
342 */
343 createForumTopic(chat_id: number | string, name: string, extra?: tt.ExtraCreateForumTopic): Promise<tg.ForumTopic>;
344 /**
345 * Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in
346 * the chat for this to work and must have can_manage_topics administrator rights, unless it is the creator of the
347 * topic. Returns True on success.
348 *
349 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
350 * @param message_thread_id Unique identifier for the target message thread of the forum topic
351 *
352 * @see https://core.telegram.org/bots/api#editforumtopic
353 */
354 editForumTopic(chat_id: number | string, message_thread_id: number, extra: tt.ExtraEditForumTopic): Promise<true>;
355 /**
356 * Use this method to close an open topic in a forum supergroup chat. The bot must be an administrator in the chat
357 * for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic.
358 * Returns True on success.
359 *
360 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
361 * @param message_thread_id Unique identifier for the target message thread of the forum topic
362 *
363 * @see https://core.telegram.org/bots/api#closeforumtopic
364 */
365 closeForumTopic(chat_id: number | string, message_thread_id: number): Promise<true>;
366 /**
367 * Use this method to reopen a closed topic in a forum supergroup chat. The bot must be an administrator in the chat
368 * for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic.
369 * Returns True on success.
370 *
371 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
372 * @param message_thread_id Unique identifier for the target message thread of the forum topic
373 *
374 * @see https://core.telegram.org/bots/api#reopenforumtopic
375 */
376 reopenForumTopic(chat_id: number | string, message_thread_id: number): Promise<true>;
377 /**
378 * Use this method to delete a forum topic along with all its messages in a forum supergroup chat. The bot must be an
379 * administrator in the chat for this to work and must have the can_delete_messages administrator rights.
380 * Returns True on success.
381 *
382 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
383 * @param message_thread_id Unique identifier for the target message thread of the forum topic
384 *
385 * @see https://core.telegram.org/bots/api#deleteforumtopic
386 */
387 deleteForumTopic(chat_id: number | string, message_thread_id: number): Promise<true>;
388 /**
389 * Use this method to clear the list of pinned messages in a forum topic. The bot must be an administrator in the chat
390 * for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success.
391 *
392 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
393 * @param message_thread_id Unique identifier for the target message thread of the forum topic
394 *
395 * @see https://core.telegram.org/bots/api#unpinallforumtopicmessages
396 */
397 unpinAllForumTopicMessages(chat_id: number | string, message_thread_id: number): Promise<true>;
398 /**
399 * Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator
400 * in the chat for this to work and must have can_manage_topics administrator rights. Returns True on success.
401 *
402 * @param chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
403 * @param name New topic name, 1-128 characters
404 *
405 * @see https://core.telegram.org/bots/api#editgeneralforumtopic
406 */
407 editGeneralForumTopic(chat_id: number | string, name: string): Promise<true>;
408 /**
409 * Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the
410 * chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.
411 *
412 * @param chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
413 *
414 * @see https://core.telegram.org/bots/api#closegeneralforumtopic
415 */
416 closeGeneralForumTopic(chat_id: number | string): Promise<true>;
417 /**
418 * Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in
419 * the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically
420 * unhidden if it was hidden. Returns True on success.
421 *
422 * @param chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
423 *
424 * @see https://core.telegram.org/bots/api#reopengeneralforumtopic
425 */
426 reopenGeneralForumTopic(chat_id: number | string): Promise<true>;
427 /**
428 * Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat
429 * for this to work and must have the can_manage_topics administrator rights. The topic will be automatically closed
430 * if it was open. Returns True on success.
431 *
432 * @param chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
433 *
434 * @see https://core.telegram.org/bots/api#hidegeneralforumtopic
435 */
436 hideGeneralForumTopic(chat_id: number | string): Promise<true>;
437 /**
438 * Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the
439 * chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.
440 *
441 * @param chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
442 *
443 * @see https://core.telegram.org/bots/api#unhidegeneralforumtopic
444 */
445 unhideGeneralForumTopic(chat_id: number | string): Promise<true>;
446 /**
447 * Use this method to clear the list of pinned messages in a General forum topic.
448 * The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator
449 * right in the supergroup.
450 *
451 * @param chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
452 */
453 unpinAllGeneralForumTopicMessages(chat_id: number | string): Promise<true>;
454 getStickerSet(name: string): Promise<tg.StickerSet>;
455 /**
456 * Upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet methods (can be used multiple times).
457 * https://core.telegram.org/bots/api#sending-files
458 * @param ownerId User identifier of sticker file owner
459 * @param stickerFile Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px.
460 */
461 uploadStickerFile(ownerId: number, sticker: tg.Opts<'uploadStickerFile'>['sticker'], sticker_format: tg.Opts<'uploadStickerFile'>['sticker_format']): Promise<tg.File>;
462 /**
463 * Create new sticker set owned by a user. The bot will be able to edit the created sticker set.
464 * @param ownerId User identifier of created sticker set owner
465 * @param name Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can contain only english letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in “_by_<bot username>”. <bot_username> is case insensitive. 1-64 characters.
466 * @param title Sticker set title, 1-64 characters
467 */
468 createNewStickerSet(ownerId: number, name: string, title: string, stickerData: tt.ExtraCreateNewStickerSet): Promise<true>;
469 /**
470 * Add a new sticker to a set created by the bot.
471 * @param ownerId User identifier of sticker set owner
472 * @param name Sticker set name
473 */
474 addStickerToSet(ownerId: number, name: string, stickerData: tt.ExtraAddStickerToSet): Promise<true>;
475 /**
476 * Move a sticker in a set created by the bot to a specific position.
477 * @param sticker File identifier of the sticker
478 * @param position New sticker position in the set, zero-based
479 */
480 setStickerPositionInSet(sticker: string, position: number): Promise<true>;
481 /**
482 * @deprecated since API 6.8. Use {@link Telegram.setStickerSetThumbnail}
483 */
484 get setStickerSetThumb(): (name: string, userId: number, thumbnail?: string | tg.InputFile | undefined) => Promise<true>;
485 /**
486 * Use this method to set the thumbnail of a regular or mask sticker set.
487 * The format of the thumbnail file must match the format of the stickers in the set.
488 * @param name Sticker set name
489 * @param userId User identifier of the sticker set owner
490 * @param thumbnail A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size
491 * and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to
492 * 32 kilobytes in size (see
493 * [animated sticker technical requirements](https://core.telegram.org/stickers#animated-sticker-requirements)),
494 * or a WEBM video with the thumbnail up to 32 kilobytes in size; see
495 * [video sticker technical requirements](https://core.telegram.org/stickers#video-sticker-requirements).
496 * Pass a file_id as a String to send a file that already exists on the Telegram servers, pass a
497 * HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using
498 * Input helpers. Animated and video sticker set thumbnails can't be uploaded via HTTP URL.
499 * If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.
500 */
501 setStickerSetThumbnail(name: string, userId: number, thumbnail?: tg.Opts<'setStickerSetThumbnail'>['thumbnail']): Promise<true>;
502 setStickerMaskPosition(sticker: string, mask_position?: tg.MaskPosition): Promise<true>;
503 setStickerKeywords(sticker: string, keywords?: string[]): Promise<true>;
504 setStickerEmojiList(sticker: string, emoji_list: string[]): Promise<true>;
505 deleteStickerSet(name: string): Promise<true>;
506 setStickerSetTitle(name: string, title: string): Promise<true>;
507 setCustomEmojiStickerSetThumbnail(name: string, custom_emoji_id: string): Promise<true>;
508 /**
509 * Delete a sticker from a set created by the bot.
510 * @param sticker File identifier of the sticker
511 */
512 deleteStickerFromSet(sticker: string): Promise<true>;
513 getCustomEmojiStickers(custom_emoji_ids: string[]): Promise<tg.Sticker[]>;
514 /**
515 * Change the list of the bot's commands.
516 * @param commands A list of bot commands to be set as the list of the bot's commands. At most 100 commands can be specified.
517 */
518 setMyCommands(commands: readonly tg.BotCommand[], extra?: tt.ExtraSetMyCommands): Promise<true>;
519 deleteMyCommands(extra?: tg.Opts<'deleteMyCommands'>): Promise<true>;
520 /**
521 * Get the current list of the bot's commands.
522 */
523 getMyCommands(extra?: tg.Opts<'getMyCommands'>): Promise<tg.BotCommand[]>;
524 /**
525 * Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty.
526 * @param description New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language.
527 * @param language_code A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for whose language there is no dedicated description.
528 */
529 setMyDescription(description: string, language_code?: string): Promise<true>;
530 /**
531 * Use this method to change the bot's name.
532 * @param name New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language.
533 * @param language_code A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose language there is no dedicated name.
534 */
535 setMyName(name: string, language_code?: string): Promise<true>;
536 /**
537 * Use this method to get the current bot name for the given user language.
538 * @param language_code A two-letter ISO 639-1 language code or an empty string
539 */
540 getMyName(language_code?: string): Promise<tg.BotName>;
541 /**
542 * Use this method to get the current bot description for the given user language.
543 * @param language_code A two-letter ISO 639-1 language code.
544 */
545 getMyDescription(language_code?: string): Promise<tg.BotDescription>;
546 /**
547 * Use this method to change the bot's short description, which is shown on the bot's profile page and is sent together with the link when users share the bot.
548 * @param description New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language.
549 * @param language_code A two-letter ISO 639-1 language code. If empty, the short description will be applied to all users for whose language there is no dedicated short description.
550 */
551 setMyShortDescription(short_description: string, language_code?: string): Promise<true>;
552 /**
553 * Use this method to get the current bot short description for the given user language.
554 * @param language_code A two-letter ISO 639-1 language code or an empty string
555 */
556 getMyShortDescription(language_code?: string): Promise<tg.BotShortDescription>;
557 setPassportDataErrors(userId: number, errors: readonly tg.PassportElementError[]): Promise<true>;
558 /**
559 * Send copy of existing message.
560 * @deprecated use `copyMessage` instead
561 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
562 * @param message Received message object
563 */
564 sendCopy(chatId: number | string, message: tg.Message, extra?: tt.ExtraCopyMessage): Promise<tg.MessageId>;
565 /**
566 * Send copy of existing message.
567 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
568 * @param fromChatId Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
569 * @param messageId Message identifier in the chat specified in from_chat_id
570 */
571 copyMessage(chatId: number | string, fromChatId: number | string, messageId: number, extra?: tt.ExtraCopyMessage): Promise<tg.MessageId>;
572 /**
573 * Approve a chat join request.
574 * The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right.
575 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
576 * @param userId Unique identifier of the target user
577 */
578 approveChatJoinRequest(chatId: number | string, userId: number): Promise<true>;
579 /**
580 * Decline a chat join request.
581 * The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right.
582 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
583 * @param userId Unique identifier of the target user
584 */
585 declineChatJoinRequest(chatId: number | string, userId: number): Promise<true>;
586 /**
587 * Ban a channel chat in a supergroup or a channel. The owner of the chat will not be able to send messages and join live streams on behalf of the chat, unless it is unbanned first.
588 * The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights.
589 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
590 * @param senderChatId Unique identifier of the target sender chat
591 */
592 banChatSenderChat(chatId: number | string, senderChatId: number, extra?: tt.ExtraBanChatSenderChat): Promise<true>;
593 /**
594 * Unban a previously banned channel chat in a supergroup or channel.
595 * The bot must be an administrator for this to work and must have the appropriate administrator rights.
596 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
597 * @param senderChatId Unique identifier of the target sender chat
598 */
599 unbanChatSenderChat(chatId: number | string, senderChatId: number): Promise<true>;
600 /**
601 * Use this method to change the bot's menu button in a private chat, or the default menu button. Returns true on success.
602 * @param chatId Unique identifier for the target private chat. If not specified, default bot's menu button will be changed.
603 * @param menuButton An object for the bot's new menu button.
604 */
605 setChatMenuButton({ chatId, menuButton, }?: {
606 chatId?: number | undefined;
607 menuButton?: tg.MenuButton | undefined;
608 }): Promise<true>;
609 /**
610 * Use this method to get the current value of the bot's menu button in a private chat, or the default menu button. Returns MenuButton on success.
611 * @param chatId Unique identifier for the target private chat. If not specified, default bot's menu button will be returned.
612 */
613 getChatMenuButton({ chatId }?: {
614 chatId?: number;
615 }): Promise<tg.MenuButton>;
616 /**
617 * Use this method to change the default administrator rights requested by the bot when it's added as an administrator to groups or channels.
618 * These rights will be suggested to users, but they are are free to modify the list before adding the bot.
619 */
620 setMyDefaultAdministratorRights({ rights, forChannels, }?: {
621 rights?: tg.ChatAdministratorRights;
622 forChannels?: boolean;
623 }): Promise<true>;
624 /**
625 * Use this method to get the current default administrator rights of the bot. Returns ChatAdministratorRights on success.
626 * @param forChannels Pass true to get default administrator rights of the bot in channels. Otherwise, default administrator rights of the bot for groups and supergroups will be returned.
627 */
628 getMyDefaultAdministratorRights({ forChannels, }?: {
629 forChannels?: boolean;
630 }): Promise<tg.ChatAdministratorRights>;
631 /**
632 * Log out from the cloud Bot API server before launching the bot locally.
633 */
634 logOut(): Promise<true>;
635 /**
636 * Close the bot instance before moving it from one local server to another.
637 */
638 close(): Promise<true>;
639}
640export default Telegram;
641//# sourceMappingURL=telegram.d.ts.map
\No newline at end of file