UNPKG

49.5 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 to forward multiple messages of any kind. If some of the specified messages can't be found or forwarded, they are skipped. Service messages and messages with protected content can't be forwarded. Album grouping is kept for forwarded messages.
55 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
56 * @param fromChatId Unique identifier for the chat where the original messages were sent (or channel username in the format @channelusername)
57 * @param messageIds Identifiers of 1-100 messages in the chat from_chat_id to forward. The identifiers must be specified in a strictly increasing order.
58 */
59 forwardMessages(chatId: number | string, fromChatId: number | string, messageIds: number[], extra?: tt.ExtraForwardMessages): Promise<tg.MessageId[]>;
60 /**
61 * Use this method when you need to tell the user that something is happening on the bot's side.
62 * The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status).
63 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
64 */
65 sendChatAction(chat_id: number | string, action: tt.ChatAction, extra?: tt.ExtraSendChatAction): Promise<true>;
66 /**
67 * Use this method to change the chosen reactions on a message. Service messages can't be reacted to.
68 * Automatically forwarded messages from a channel to its discussion group have the same available
69 * reactions as messages in the channel. In albums, bots must react to the first message.
70 * @param chat_id Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
71 * @param message_id Identifier of the target message
72 * @param reaction New list of reaction types to set on the message. Currently, as non-premium users, bots can set up
73 * to one reaction per message. A custom emoji reaction can be used if it is either already present on the message
74 * or explicitly allowed by chat administrators.
75 * @param is_big Pass True to set the reaction with a big animation
76 * @returns
77 */
78 setMessageReaction(chat_id: number | string, message_id: number, reaction?: tg.ReactionType[], is_big?: boolean): Promise<true>;
79 getUserProfilePhotos(userId: number, offset?: number, limit?: number): Promise<tg.UserProfilePhotos>;
80 /**
81 * Send point on the map.
82 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
83 */
84 sendLocation(chatId: number | string, latitude: number, longitude: number, extra?: tt.ExtraLocation): Promise<tg.Message.LocationMessage>;
85 sendVenue(chatId: number | string, latitude: number, longitude: number, title: string, address: string, extra?: tt.ExtraVenue): Promise<tg.Message.VenueMessage>;
86 /**
87 * @param chatId Unique identifier for the target private chat
88 */
89 sendInvoice(chatId: number | string, invoice: tt.NewInvoiceParameters, extra?: tt.ExtraInvoice): Promise<tg.Message.InvoiceMessage>;
90 sendContact(chatId: number | string, phoneNumber: string, firstName: string, extra?: tt.ExtraContact): Promise<tg.Message.ContactMessage>;
91 /**
92 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
93 */
94 sendPhoto(chatId: number | string, photo: tg.Opts<'sendPhoto'>['photo'], extra?: tt.ExtraPhoto): Promise<tg.Message.PhotoMessage>;
95 /**
96 * Send a dice, which will have a random value from 1 to 6.
97 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
98 */
99 sendDice(chatId: number | string, extra?: tt.ExtraDice): Promise<tg.Message.DiceMessage>;
100 /**
101 * 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.
102 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
103 */
104 sendDocument(chatId: number | string, document: tg.Opts<'sendDocument'>['document'], extra?: tt.ExtraDocument): Promise<tg.Message.DocumentMessage>;
105 /**
106 * Send audio files, if you want Telegram clients to display them in the music player.
107 * Your audio must be in the .mp3 format.
108 * Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.
109 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
110 */
111 sendAudio(chatId: number | string, audio: tg.Opts<'sendAudio'>['audio'], extra?: tt.ExtraAudio): Promise<tg.Message.AudioMessage>;
112 /**
113 * Send .webp, animated .tgs, or video .webm stickers
114 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
115 */
116 sendSticker(chatId: number | string, sticker: tg.Opts<'sendSticker'>['sticker'], extra?: tt.ExtraSticker): Promise<tg.Message.StickerMessage>;
117 /**
118 * Send video files, Telegram clients support mp4 videos (other formats may be sent as Document).
119 * Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.
120 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
121 */
122 sendVideo(chatId: number | string, video: tg.Opts<'sendVideo'>['video'], extra?: tt.ExtraVideo): Promise<tg.Message.VideoMessage>;
123 /**
124 * Send .gif animations.
125 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
126 */
127 sendAnimation(chatId: number | string, animation: tg.Opts<'sendAnimation'>['animation'], extra?: tt.ExtraAnimation): Promise<tg.Message.AnimationMessage>;
128 /**
129 * Send video messages.
130 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
131 */
132 sendVideoNote(chatId: number | string, videoNote: string | tg.InputFileVideoNote, extra?: tt.ExtraVideoNote): Promise<tg.Message.VideoNoteMessage>;
133 /**
134 * 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.
135 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
136 */
137 sendVoice(chatId: number | string, voice: tg.Opts<'sendVoice'>['voice'], extra?: tt.ExtraVoice): Promise<tg.Message.VoiceMessage>;
138 /**
139 * @param chatId Unique identifier for the target chat
140 * @param gameShortName Short name of the game, serves as the unique identifier for the game. Set up your games via Botfather.
141 */
142 sendGame(chatId: number, gameName: string, extra?: tt.ExtraGame): Promise<tg.Message.GameMessage>;
143 /**
144 * Send a group of photos or videos as an album.
145 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
146 * @param media A JSON-serialized array describing photos and videos to be sent, must include 2–10 items
147 */
148 sendMediaGroup(chatId: number | string, media: tt.MediaGroup, extra?: tt.ExtraMediaGroup): Promise<(tg.Message.DocumentMessage | tg.Message.AudioMessage | tg.Message.PhotoMessage | tg.Message.VideoMessage)[]>;
149 /**
150 * Send a native poll.
151 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
152 * @param question Poll question, 1-255 characters
153 * @param options A JSON-serialized list of answer options, 2-10 strings 1-100 characters each
154 */
155 sendPoll(chatId: number | string, question: string, options: readonly string[], extra?: tt.ExtraPoll): Promise<tg.Message.PollMessage>;
156 /**
157 * Send a native quiz.
158 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
159 * @param question Poll question, 1-255 characters
160 * @param options A JSON-serialized list of answer options, 2-10 strings 1-100 characters each
161 */
162 sendQuiz(chatId: number | string, question: string, options: readonly string[], extra?: tt.ExtraPoll): Promise<tg.Message.PollMessage>;
163 /**
164 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
165 * @param messageId Identifier of the original message with the poll
166 */
167 stopPoll(chatId: number | string, messageId: number, extra?: tt.ExtraStopPoll): Promise<tg.Poll>;
168 /**
169 * 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.).
170 * @param chatId Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
171 */
172 getChat(chatId: number | string): Promise<tg.ChatFromGetChat>;
173 /**
174 * @param chatId Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
175 */
176 getChatAdministrators(chatId: number | string): Promise<(tg.ChatMemberOwner | tg.ChatMemberAdministrator)[]>;
177 /**
178 * Get information about a member of a chat.
179 * @param chatId Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
180 * @param userId Unique identifier of the target user
181 */
182 getChatMember(chatId: string | number, userId: number): Promise<tg.ChatMember>;
183 /**
184 * Get the number of members in a chat.
185 * @param chatId Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
186 */
187 getChatMembersCount(chatId: string | number): Promise<number>;
188 /**
189 * Send answers to an inline query.
190 * No more than 50 results per query are allowed.
191 */
192 answerInlineQuery(inlineQueryId: string, results: readonly tg.InlineQueryResult[], extra?: tt.ExtraAnswerInlineQuery): Promise<true>;
193 setChatPermissions(chatId: number | string, permissions: tg.ChatPermissions, extra?: tt.ExtraSetChatPermissions): Promise<true>;
194 /**
195 * 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.
196 * @param chatId Unique identifier for the target group or username of the target supergroup or channel (in the format `@channelusername`)
197 * @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
198 */
199 banChatMember(chatId: number | string, userId: number, untilDate?: number, extra?: tt.ExtraBanChatMember): Promise<true>;
200 /**
201 * 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.
202 * @param chatId Unique identifier for the target group or username of the target supergroup or channel (in the format `@channelusername`)
203 * @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
204 * @deprecated since API 5.3. Use {@link Telegram.banChatMember}
205 */
206 get kickChatMember(): (chatId: string | number, userId: number, untilDate?: number | undefined, extra?: Omit<{
207 chat_id: string | number;
208 user_id: number;
209 until_date?: number | undefined;
210 revoke_messages?: boolean | undefined;
211 }, "chat_id" | "user_id" | "until_date"> | undefined) => Promise<true>;
212 /**
213 * 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.
214 * @param chatId Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
215 */
216 promoteChatMember(chatId: number | string, userId: number, extra: tt.ExtraPromoteChatMember): Promise<true>;
217 /**
218 * 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.
219 * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
220 */
221 restrictChatMember(chatId: string | number, userId: number, extra: tt.ExtraRestrictChatMember): Promise<true>;
222 setChatAdministratorCustomTitle(chatId: number | string, userId: number, title: string): Promise<true>;
223 /**
224 * 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.
225 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
226 */
227 exportChatInviteLink(chatId: number | string): Promise<string>;
228 createChatInviteLink(chatId: number | string, extra?: tt.ExtraCreateChatInviteLink): Promise<tg.ChatInviteLink>;
229 createInvoiceLink(invoice: tt.NewInvoiceLinkParameters): Promise<string>;
230 editChatInviteLink(chatId: number | string, inviteLink: string, extra?: tt.ExtraEditChatInviteLink): Promise<tg.ChatInviteLink>;
231 revokeChatInviteLink(chatId: number | string, inviteLink: string): Promise<tg.ChatInviteLink>;
232 setChatPhoto(chatId: number | string, photo: tg.Opts<'setChatPhoto'>['photo']): Promise<true>;
233 deleteChatPhoto(chatId: number | string): Promise<true>;
234 /**
235 * 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.
236 * @param chatId Unique identifier for the target group or username of the target supergroup or channel (in the format `@channelusername`)
237 * @param title New chat title, 1-255 characters
238 */
239 setChatTitle(chatId: number | string, title: string): Promise<true>;
240 setChatDescription(chatId: number | string, description?: string): Promise<true>;
241 /**
242 * 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.
243 * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
244 */
245 pinChatMessage(chatId: number | string, messageId: number, extra?: {
246 disable_notification?: boolean;
247 }): Promise<true>;
248 /**
249 * 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.
250 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
251 */
252 unpinChatMessage(chatId: number | string, messageId?: number): Promise<true>;
253 /**
254 * Clear the list of pinned messages in a chat.
255 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
256 */
257 unpinAllChatMessages(chatId: number | string): Promise<true>;
258 /**
259 * Use this method for your bot to leave a group, supergroup or channel.
260 * @param chatId Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
261 */
262 leaveChat(chatId: number | string): Promise<true>;
263 /**
264 * 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.
265 * @param chatId Unique identifier for the target group or username of the target supergroup or channel (in the format @username)
266 * @param userId Unique identifier of the target user
267 */
268 unbanChatMember(chatId: number | string, userId: number, extra?: {
269 only_if_banned?: boolean;
270 }): Promise<true>;
271 answerCbQuery(callbackQueryId: string, text?: string, extra?: tt.ExtraAnswerCbQuery): Promise<true>;
272 answerGameQuery(callbackQueryId: string, url: string): Promise<true>;
273 /**
274 * Use this method to get the list of boosts added to a chat by a user. Requires administrator rights in the chat. Returns a UserChatBoosts object.
275 * @param chat_id Unique identifier for the chat or username of the channel (in the format `@channelusername`)
276 * @param user_id Unique identifier of the target user
277 */
278 getUserChatBoosts(chat_id: number | string, user_id: number): Promise<tg.UserChatBoosts[]>;
279 /**
280 * If you sent an invoice requesting a shipping address and the parameter is_flexible was specified,
281 * the Bot API will send an Update with a shipping_query field to the bot.
282 * Reply to shipping queries.
283 * @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)
284 * @param shippingOptions Required if ok is True. A JSON-serialized array of available shipping options.
285 * @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.
286 */
287 answerShippingQuery(shippingQueryId: string, ok: boolean, shippingOptions: readonly tg.ShippingOption[] | undefined, errorMessage: string | undefined): Promise<true>;
288 /**
289 * 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.
290 * Respond to such pre-checkout queries. On success, True is returned.
291 * Note: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent.
292 * @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.
293 * @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.
294 */
295 answerPreCheckoutQuery(preCheckoutQueryId: string, ok: boolean, errorMessage?: string): Promise<true>;
296 answerWebAppQuery(webAppQueryId: string, result: tg.InlineQueryResult): Promise<tg.SentWebAppMessage>;
297 /**
298 * Edit text and game messages sent by the bot or via the bot (for inline bots).
299 * On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
300 * @param chatId Required if inlineMessageId is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
301 * @param messageId Required if inlineMessageId is not specified. Identifier of the sent message
302 * @param inlineMessageId Required if chatId and messageId are not specified. Identifier of the inline message
303 * @param text New text of the message
304 */
305 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)>;
306 /**
307 * Edit captions of messages sent by the bot or via the bot (for inline bots).
308 * On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
309 * @param chatId Required if inlineMessageId is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
310 * @param messageId Required if inlineMessageId is not specified. Identifier of the sent message
311 * @param inlineMessageId Required if chatId and messageId are not specified. Identifier of the inline message
312 * @param caption New caption of the message
313 * @param markup A JSON-serialized object for an inline keyboard.
314 */
315 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)>;
316 /**
317 * Edit animation, audio, document, photo, or video messages.
318 * If a message is a part of a message album, then it can be edited only to a photo or a video.
319 * Otherwise, message type can be changed arbitrarily.
320 * When inline message is edited, new file can't be uploaded.
321 * Use previously uploaded file via its file_id or specify a URL.
322 * @param chatId Required if inlineMessageId is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
323 * @param messageId Required if inlineMessageId is not specified. Identifier of the sent message
324 * @param inlineMessageId Required if chatId and messageId are not specified. Identifier of the inline message
325 * @param media New media of message
326 * @param extra Additional parameters, such as reply_markup
327 */
328 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)>;
329 /**
330 * Edit only the reply markup of messages sent by the bot or via the bot (for inline bots).
331 * @param chatId Required if inlineMessageId is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
332 * @param messageId Required if inlineMessageId is not specified. Identifier of the sent message
333 * @param inlineMessageId Required if chatId and messageId are not specified. Identifier of the inline message
334 * @param markup A JSON-serialized object for an inline keyboard.
335 * @returns If edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
336 */
337 editMessageReplyMarkup(chatId: number | string | undefined, messageId: number | undefined, inlineMessageId: string | undefined, markup: tg.InlineKeyboardMarkup | undefined): Promise<true | (tg.Update.Edited & tg.Message)>;
338 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)>;
339 stopMessageLiveLocation(chatId: number | string | undefined, messageId: number | undefined, inlineMessageId: string | undefined, markup?: tg.InlineKeyboardMarkup): Promise<true | (tg.Update.Edited & tg.Message.LocationMessage)>;
340 /**
341 * Delete a message, including service messages, with the following limitations:
342 * - A message can only be deleted if it was sent less than 48 hours ago.
343 * - Bots can delete outgoing messages in groups and supergroups.
344 * - Bots granted can_post_messages permissions can delete outgoing messages in channels.
345 * - If the bot is an administrator of a group, it can delete any message there.
346 * - If the bot has can_delete_messages permission in a supergroup or a channel, it can delete any message there.
347 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
348 * @param messageId Identifier of the message to delete
349 */
350 deleteMessage(chatId: number | string, messageId: number): Promise<true>;
351 /**
352 * Use this method to delete multiple messages simultaneously. If some of the specified messages can't be found, they are skipped.
353 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
354 * @param messageIds Identifiers of 1-100 messages to delete. See deleteMessage for limitations on which messages can be deleted
355 */
356 deleteMessages(chatId: number | string, messageIds: number[]): Promise<true>;
357 setChatStickerSet(chatId: number | string, setName: string): Promise<true>;
358 deleteChatStickerSet(chatId: number | string): Promise<true>;
359 /**
360 * Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user.
361 * Requires no parameters. Returns an Array of Sticker objects.
362 *
363 * @see https://core.telegram.org/bots/api#getforumtopiciconstickers
364 */
365 getForumTopicIconStickers(): Promise<tg.Sticker[]>;
366 /**
367 * Use this method to create a topic in a forum supergroup chat. The bot must be an administrator in the chat for this
368 * to work and must have the can_manage_topics administrator rights. Returns information about the created topic as a
369 * ForumTopic object.
370 *
371 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
372 * @param name Topic name, 1-128 characters
373 *
374 * @see https://core.telegram.org/bots/api#createforumtopic
375 */
376 createForumTopic(chat_id: number | string, name: string, extra?: tt.ExtraCreateForumTopic): Promise<tg.ForumTopic>;
377 /**
378 * Use this method to edit name and icon of a topic in a forum supergroup chat. The bot must be an administrator in
379 * the chat for this to work and must have can_manage_topics administrator rights, unless it is the creator of the
380 * topic. 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#editforumtopic
386 */
387 editForumTopic(chat_id: number | string, message_thread_id: number, extra: tt.ExtraEditForumTopic): Promise<true>;
388 /**
389 * Use this method to close an open topic in a forum supergroup chat. The bot must be an administrator in the chat
390 * for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic.
391 * Returns True on success.
392 *
393 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
394 * @param message_thread_id Unique identifier for the target message thread of the forum topic
395 *
396 * @see https://core.telegram.org/bots/api#closeforumtopic
397 */
398 closeForumTopic(chat_id: number | string, message_thread_id: number): Promise<true>;
399 /**
400 * Use this method to reopen a closed topic in a forum supergroup chat. The bot must be an administrator in the chat
401 * for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic.
402 * Returns True on success.
403 *
404 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
405 * @param message_thread_id Unique identifier for the target message thread of the forum topic
406 *
407 * @see https://core.telegram.org/bots/api#reopenforumtopic
408 */
409 reopenForumTopic(chat_id: number | string, message_thread_id: number): Promise<true>;
410 /**
411 * Use this method to delete a forum topic along with all its messages in a forum supergroup chat. The bot must be an
412 * administrator in the chat for this to work and must have the can_delete_messages administrator rights.
413 * Returns True on success.
414 *
415 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
416 * @param message_thread_id Unique identifier for the target message thread of the forum topic
417 *
418 * @see https://core.telegram.org/bots/api#deleteforumtopic
419 */
420 deleteForumTopic(chat_id: number | string, message_thread_id: number): Promise<true>;
421 /**
422 * Use this method to clear the list of pinned messages in a forum topic. The bot must be an administrator in the chat
423 * for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success.
424 *
425 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
426 * @param message_thread_id Unique identifier for the target message thread of the forum topic
427 *
428 * @see https://core.telegram.org/bots/api#unpinallforumtopicmessages
429 */
430 unpinAllForumTopicMessages(chat_id: number | string, message_thread_id: number): Promise<true>;
431 /**
432 * Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator
433 * in the chat for this to work and must have can_manage_topics administrator rights. Returns True on success.
434 *
435 * @param chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
436 * @param name New topic name, 1-128 characters
437 *
438 * @see https://core.telegram.org/bots/api#editgeneralforumtopic
439 */
440 editGeneralForumTopic(chat_id: number | string, name: string): Promise<true>;
441 /**
442 * Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the
443 * chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.
444 *
445 * @param chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
446 *
447 * @see https://core.telegram.org/bots/api#closegeneralforumtopic
448 */
449 closeGeneralForumTopic(chat_id: number | string): Promise<true>;
450 /**
451 * Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in
452 * the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically
453 * unhidden if it was hidden. Returns True on success.
454 *
455 * @param chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
456 *
457 * @see https://core.telegram.org/bots/api#reopengeneralforumtopic
458 */
459 reopenGeneralForumTopic(chat_id: number | string): Promise<true>;
460 /**
461 * Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat
462 * for this to work and must have the can_manage_topics administrator rights. The topic will be automatically closed
463 * if it was open. Returns True on success.
464 *
465 * @param chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
466 *
467 * @see https://core.telegram.org/bots/api#hidegeneralforumtopic
468 */
469 hideGeneralForumTopic(chat_id: number | string): Promise<true>;
470 /**
471 * Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the
472 * chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.
473 *
474 * @param chat_id Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
475 *
476 * @see https://core.telegram.org/bots/api#unhidegeneralforumtopic
477 */
478 unhideGeneralForumTopic(chat_id: number | string): 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 unpinAllGeneralForumTopicMessages(chat_id: number | string): Promise<true>;
487 getStickerSet(name: string): Promise<tg.StickerSet>;
488 /**
489 * Upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet methods (can be used multiple times).
490 * https://core.telegram.org/bots/api#sending-files
491 * @param ownerId User identifier of sticker file owner
492 * @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.
493 */
494 uploadStickerFile(ownerId: number, sticker: tg.Opts<'uploadStickerFile'>['sticker'], sticker_format: tg.Opts<'uploadStickerFile'>['sticker_format']): Promise<tg.File>;
495 /**
496 * Create new sticker set owned by a user. The bot will be able to edit the created sticker set.
497 * @param ownerId User identifier of created sticker set owner
498 * @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.
499 * @param title Sticker set title, 1-64 characters
500 */
501 createNewStickerSet(ownerId: number, name: string, title: string, stickerData: tt.ExtraCreateNewStickerSet): Promise<true>;
502 /**
503 * Add a new sticker to a set created by the bot.
504 * @param ownerId User identifier of sticker set owner
505 * @param name Sticker set name
506 */
507 addStickerToSet(ownerId: number, name: string, stickerData: tt.ExtraAddStickerToSet): Promise<true>;
508 /**
509 * Move a sticker in a set created by the bot to a specific position.
510 * @param sticker File identifier of the sticker
511 * @param position New sticker position in the set, zero-based
512 */
513 setStickerPositionInSet(sticker: string, position: number): Promise<true>;
514 /**
515 * @deprecated since API 6.8. Use {@link Telegram.setStickerSetThumbnail}
516 */
517 get setStickerSetThumb(): (name: string, userId: number, thumbnail?: string | tg.InputFile | undefined) => Promise<true>;
518 /**
519 * Use this method to set the thumbnail of a regular or mask sticker set.
520 * The format of the thumbnail file must match the format of the stickers in the set.
521 * @param name Sticker set name
522 * @param userId User identifier of the sticker set owner
523 * @param thumbnail A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size
524 * and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to
525 * 32 kilobytes in size (see
526 * [animated sticker technical requirements](https://core.telegram.org/stickers#animated-sticker-requirements)),
527 * or a WEBM video with the thumbnail up to 32 kilobytes in size; see
528 * [video sticker technical requirements](https://core.telegram.org/stickers#video-sticker-requirements).
529 * Pass a file_id as a String to send a file that already exists on the Telegram servers, pass a
530 * HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using
531 * Input helpers. Animated and video sticker set thumbnails can't be uploaded via HTTP URL.
532 * If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.
533 */
534 setStickerSetThumbnail(name: string, userId: number, thumbnail?: tg.Opts<'setStickerSetThumbnail'>['thumbnail']): Promise<true>;
535 setStickerMaskPosition(sticker: string, mask_position?: tg.MaskPosition): Promise<true>;
536 setStickerKeywords(sticker: string, keywords?: string[]): Promise<true>;
537 setStickerEmojiList(sticker: string, emoji_list: string[]): Promise<true>;
538 deleteStickerSet(name: string): Promise<true>;
539 setStickerSetTitle(name: string, title: string): Promise<true>;
540 setCustomEmojiStickerSetThumbnail(name: string, custom_emoji_id: string): Promise<true>;
541 /**
542 * Delete a sticker from a set created by the bot.
543 * @param sticker File identifier of the sticker
544 */
545 deleteStickerFromSet(sticker: string): Promise<true>;
546 getCustomEmojiStickers(custom_emoji_ids: string[]): Promise<tg.Sticker[]>;
547 /**
548 * Change the list of the bot's commands.
549 * @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.
550 */
551 setMyCommands(commands: readonly tg.BotCommand[], extra?: tt.ExtraSetMyCommands): Promise<true>;
552 deleteMyCommands(extra?: tg.Opts<'deleteMyCommands'>): Promise<true>;
553 /**
554 * Get the current list of the bot's commands.
555 */
556 getMyCommands(extra?: tg.Opts<'getMyCommands'>): Promise<tg.BotCommand[]>;
557 /**
558 * Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty.
559 * @param description New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language.
560 * @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.
561 */
562 setMyDescription(description: string, language_code?: string): Promise<true>;
563 /**
564 * Use this method to change the bot's name.
565 * @param name New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language.
566 * @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.
567 */
568 setMyName(name: string, language_code?: string): Promise<true>;
569 /**
570 * Use this method to get the current bot name for the given user language.
571 * @param language_code A two-letter ISO 639-1 language code or an empty string
572 */
573 getMyName(language_code?: string): Promise<tg.BotName>;
574 /**
575 * Use this method to get the current bot description for the given user language.
576 * @param language_code A two-letter ISO 639-1 language code.
577 */
578 getMyDescription(language_code?: string): Promise<tg.BotDescription>;
579 /**
580 * 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.
581 * @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.
582 * @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.
583 */
584 setMyShortDescription(short_description: string, language_code?: string): Promise<true>;
585 /**
586 * Use this method to get the current bot short description for the given user language.
587 * @param language_code A two-letter ISO 639-1 language code or an empty string
588 */
589 getMyShortDescription(language_code?: string): Promise<tg.BotShortDescription>;
590 setPassportDataErrors(userId: number, errors: readonly tg.PassportElementError[]): Promise<true>;
591 /**
592 * Send copy of existing message.
593 * @deprecated use `copyMessage` instead
594 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
595 * @param message Received message object
596 */
597 sendCopy(chatId: number | string, message: tg.Message, extra?: tt.ExtraCopyMessage): Promise<tg.MessageId>;
598 /**
599 * Send copy of existing message.
600 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
601 * @param fromChatId Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
602 * @param messageId Message identifier in the chat specified in from_chat_id
603 */
604 copyMessage(chatId: number | string, fromChatId: number | string, messageId: number, extra?: tt.ExtraCopyMessage): Promise<tg.MessageId>;
605 /**
606 * Use this method to copy messages of any kind. If some of the specified messages can't be found or copied, they are skipped. Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessages, but the copied messages don't have a link to the original message. Album grouping is kept for copied messages.
607 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
608 * @param fromChatId Unique identifier for the chat where the original messages were sent (or channel username in the format @channelusername)
609 * @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.
610 */
611 copyMessages(chatId: number | string, fromChatId: number | string, messageIds: number[], extra?: tt.ExtraCopyMessages): Promise<tg.MessageId[]>;
612 /**
613 * Approve a chat join request.
614 * The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right.
615 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
616 * @param userId Unique identifier of the target user
617 */
618 approveChatJoinRequest(chatId: number | string, userId: number): Promise<true>;
619 /**
620 * Decline a chat join request.
621 * The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right.
622 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
623 * @param userId Unique identifier of the target user
624 */
625 declineChatJoinRequest(chatId: number | string, userId: number): Promise<true>;
626 /**
627 * 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.
628 * The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights.
629 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
630 * @param senderChatId Unique identifier of the target sender chat
631 */
632 banChatSenderChat(chatId: number | string, senderChatId: number, extra?: tt.ExtraBanChatSenderChat): Promise<true>;
633 /**
634 * Unban a previously banned channel chat in a supergroup or channel.
635 * The bot must be an administrator for this to work and must have the appropriate administrator rights.
636 * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
637 * @param senderChatId Unique identifier of the target sender chat
638 */
639 unbanChatSenderChat(chatId: number | string, senderChatId: number): Promise<true>;
640 /**
641 * Use this method to change the bot's menu button in a private chat, or the default menu button. Returns true on success.
642 * @param chatId Unique identifier for the target private chat. If not specified, default bot's menu button will be changed.
643 * @param menuButton An object for the bot's new menu button.
644 */
645 setChatMenuButton({ chatId, menuButton, }?: {
646 chatId?: number | undefined;
647 menuButton?: tg.MenuButton | undefined;
648 }): Promise<true>;
649 /**
650 * 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.
651 * @param chatId Unique identifier for the target private chat. If not specified, default bot's menu button will be returned.
652 */
653 getChatMenuButton({ chatId }?: {
654 chatId?: number;
655 }): Promise<tg.MenuButton>;
656 /**
657 * Use this method to change the default administrator rights requested by the bot when it's added as an administrator to groups or channels.
658 * These rights will be suggested to users, but they are are free to modify the list before adding the bot.
659 */
660 setMyDefaultAdministratorRights({ rights, forChannels, }?: {
661 rights?: tg.ChatAdministratorRights;
662 forChannels?: boolean;
663 }): Promise<true>;
664 /**
665 * Use this method to get the current default administrator rights of the bot. Returns ChatAdministratorRights on success.
666 * @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.
667 */
668 getMyDefaultAdministratorRights({ forChannels, }?: {
669 forChannels?: boolean;
670 }): Promise<tg.ChatAdministratorRights>;
671 /**
672 * Log out from the cloud Bot API server before launching the bot locally.
673 */
674 logOut(): Promise<true>;
675 /**
676 * Close the bot instance before moving it from one local server to another.
677 */
678 close(): Promise<true>;
679}
680export default Telegram;
681//# sourceMappingURL=telegram.d.ts.map
\No newline at end of file