UNPKG

node-telegram-bot-api

Version:
827 lines (635 loc) 137 kB
# API Reference **Note:** If you are looking for available [events](usage.md#events) or usage of api, please refer [`usage.md`](usage.md). <a name="TelegramBot"></a> ## TelegramBot TelegramBot **Kind**: global class **See**: https://core.telegram.org/bots/api * [TelegramBot](#TelegramBot) * [new TelegramBot(token, [options])](#new_TelegramBot_new) * _instance_ * [.on(event, listener)](#TelegramBot+on) * [.startPolling([options])](#TelegramBot+startPolling) ⇒ <code>Promise</code> * ~~[.initPolling([options])](#TelegramBot+initPolling) ⇒ <code>Promise</code>~~ * [.stopPolling([options])](#TelegramBot+stopPolling) ⇒ <code>Promise</code> * [.getFileLink(fileId, [options])](#TelegramBot+getFileLink) ⇒ <code>Promise</code> * [.getFileStream(fileId, [options])](#TelegramBot+getFileStream) ⇒ <code>stream.Readable</code> * [.downloadFile(fileId, downloadDir, [options])](#TelegramBot+downloadFile) ⇒ <code>Promise</code> * [.onText(regexpRexecuted, callback)](#TelegramBot+onText) * [.removeTextListener(regexp)](#TelegramBot+removeTextListener) ⇒ <code>Object</code> * [.clearTextListeners()](#TelegramBot+clearTextListeners) * [.onReplyToMessage(chatId, messageId, callback)](#TelegramBot+onReplyToMessage) ⇒ <code>Number</code> * [.removeReplyListener(replyListenerId)](#TelegramBot+removeReplyListener) ⇒ <code>Object</code> * [.clearReplyListeners()](#TelegramBot+clearReplyListeners) ⇒ <code>Array</code> * [.isPolling()](#TelegramBot+isPolling) ⇒ <code>Boolean</code> * [.openWebHook()](#TelegramBot+openWebHook) ⇒ <code>Promise</code> * [.closeWebHook()](#TelegramBot+closeWebHook) ⇒ <code>Promise</code> * [.hasOpenWebHook()](#TelegramBot+hasOpenWebHook) ⇒ <code>Boolean</code> * [.processUpdate(update)](#TelegramBot+processUpdate) * [.getUpdates([options])](#TelegramBot+getUpdates) ⇒ <code>Promise</code> * [.setWebHook(url, [options], [fileOptions])](#TelegramBot+setWebHook) ⇒ <code>Promise</code> * [.deleteWebHook([options])](#TelegramBot+deleteWebHook) ⇒ <code>Promise</code> * [.getWebHookInfo([options])](#TelegramBot+getWebHookInfo) ⇒ <code>Promise</code> * [.getMe([options])](#TelegramBot+getMe) ⇒ <code>Promise</code> * [.logOut([options])](#TelegramBot+logOut) ⇒ <code>Promise</code> * [.close([options])](#TelegramBot+close) ⇒ <code>Promise</code> * [.sendMessage(chatId, text, [options])](#TelegramBot+sendMessage) ⇒ <code>Promise</code> * [.forwardMessage(chatId, fromChatId, messageId, [options])](#TelegramBot+forwardMessage) ⇒ <code>Promise</code> * [.forwardMessages(chatId, fromChatId, messageIds, [options])](#TelegramBot+forwardMessages) ⇒ <code>Promise</code> * [.copyMessage(chatId, fromChatId, messageId, [options])](#TelegramBot+copyMessage) ⇒ <code>Promise</code> * [.copyMessages(chatId, fromChatId, messageIds, [options])](#TelegramBot+copyMessages) ⇒ <code>Promise</code> * [.sendPhoto(chatId, photo, [options], [fileOptions])](#TelegramBot+sendPhoto) ⇒ <code>Promise</code> * [.sendAudio(chatId, audio, [options], [fileOptions])](#TelegramBot+sendAudio) ⇒ <code>Promise</code> * [.sendDocument(chatId, doc, [options], [fileOptions])](#TelegramBot+sendDocument) ⇒ <code>Promise</code> * [.sendVideo(chatId, video, [options], [fileOptions])](#TelegramBot+sendVideo) ⇒ <code>Promise</code> * [.sendAnimation(chatId, animation, [options], [fileOptions])](#TelegramBot+sendAnimation) ⇒ <code>Promise</code> * [.sendVoice(chatId, voice, [options], [fileOptions])](#TelegramBot+sendVoice) ⇒ <code>Promise</code> * [.sendVideoNote(chatId, videoNote, [options], [fileOptions])](#TelegramBot+sendVideoNote) ⇒ <code>Promise</code> * [.sendMediaGroup(chatId, media, [options])](#TelegramBot+sendMediaGroup) ⇒ <code>Promise</code> * [.sendLocation(chatId, latitude, longitude, [options])](#TelegramBot+sendLocation) ⇒ <code>Promise</code> * [.editMessageLiveLocation(latitude, longitude, [options])](#TelegramBot+editMessageLiveLocation) ⇒ <code>Promise</code> * [.stopMessageLiveLocation([options])](#TelegramBot+stopMessageLiveLocation) ⇒ <code>Promise</code> * [.sendVenue(chatId, latitude, longitude, title, address, [options])](#TelegramBot+sendVenue) ⇒ <code>Promise</code> * [.sendContact(chatId, phoneNumber, firstName, [options])](#TelegramBot+sendContact) ⇒ <code>Promise</code> * [.sendPoll(chatId, question, pollOptions, [options])](#TelegramBot+sendPoll) ⇒ <code>Promise</code> * [.sendDice(chatId, [options])](#TelegramBot+sendDice) ⇒ <code>Promise</code> * [.sendChatAction(chatId, action, [options])](#TelegramBot+sendChatAction) ⇒ <code>Promise</code> * [.setMessageReaction(chatId, messageId, [options])](#TelegramBot+setMessageReaction) ⇒ <code>[ &#x27;Promise&#x27; ].&lt;Boolean&gt;</code> * [.getUserProfilePhotos(userId, [options])](#TelegramBot+getUserProfilePhotos) ⇒ <code>Promise</code> * [.getFile(fileId, [options])](#TelegramBot+getFile) ⇒ <code>Promise</code> * [.banChatMember(chatId, userId, [options])](#TelegramBot+banChatMember) ⇒ <code>Promise</code> * [.unbanChatMember(chatId, userId, [options])](#TelegramBot+unbanChatMember) ⇒ <code>Promise</code> * [.restrictChatMember(chatId, userId, [options])](#TelegramBot+restrictChatMember) ⇒ <code>Promise</code> * [.promoteChatMember(chatId, userId, [options])](#TelegramBot+promoteChatMember) ⇒ <code>Promise</code> * [.setChatAdministratorCustomTitle(chatId, userId, customTitle, [options])](#TelegramBot+setChatAdministratorCustomTitle) ⇒ <code>Promise</code> * [.banChatSenderChat(chatId, senderChatId, [options])](#TelegramBot+banChatSenderChat) ⇒ <code>Promise</code> * [.unbanChatSenderChat(chatId, senderChatId, [options])](#TelegramBot+unbanChatSenderChat) ⇒ <code>Promise</code> * [.setChatPermissions(chatId, chatPermissions, [options])](#TelegramBot+setChatPermissions) ⇒ <code>Promise</code> * [.exportChatInviteLink(chatId, [options])](#TelegramBot+exportChatInviteLink) ⇒ <code>Promise</code> * [.createChatInviteLink(chatId, [options])](#TelegramBot+createChatInviteLink) ⇒ <code>Object</code> * [.editChatInviteLink(chatId, inviteLink, [options])](#TelegramBot+editChatInviteLink) ⇒ <code>Promise</code> * [.revokeChatInviteLink(chatId, inviteLink, [options])](#TelegramBot+revokeChatInviteLink) ⇒ <code>Promise</code> * [.approveChatJoinRequest(chatId, userId, [options])](#TelegramBot+approveChatJoinRequest) ⇒ <code>Promise</code> * [.declineChatJoinRequest(chatId, userId, [options])](#TelegramBot+declineChatJoinRequest) ⇒ <code>Promise</code> * [.setChatPhoto(chatId, photo, [options], [fileOptions])](#TelegramBot+setChatPhoto) ⇒ <code>Promise</code> * [.deleteChatPhoto(chatId, [options])](#TelegramBot+deleteChatPhoto) ⇒ <code>Promise</code> * [.setChatTitle(chatId, title, [options])](#TelegramBot+setChatTitle) ⇒ <code>Promise</code> * [.setChatDescription(chatId, description, [options])](#TelegramBot+setChatDescription) ⇒ <code>Promise</code> * [.pinChatMessage(chatId, messageId, [options])](#TelegramBot+pinChatMessage) ⇒ <code>Promise</code> * [.unpinChatMessage(chatId, [options])](#TelegramBot+unpinChatMessage) ⇒ <code>Promise</code> * [.unpinAllChatMessages(chatId, [options])](#TelegramBot+unpinAllChatMessages) ⇒ <code>Promise</code> * [.leaveChat(chatId, [options])](#TelegramBot+leaveChat) ⇒ <code>Promise</code> * [.getChat(chatId, [options])](#TelegramBot+getChat) ⇒ <code>Promise</code> * [.getChatAdministrators(chatId, [options])](#TelegramBot+getChatAdministrators) ⇒ <code>Promise</code> * [.getChatMemberCount(chatId, [options])](#TelegramBot+getChatMemberCount) ⇒ <code>Promise</code> * [.getChatMember(chatId, userId, [options])](#TelegramBot+getChatMember) ⇒ <code>Promise</code> * [.setChatStickerSet(chatId, stickerSetName, [options])](#TelegramBot+setChatStickerSet) ⇒ <code>Promise</code> * [.deleteChatStickerSet(chatId, [options])](#TelegramBot+deleteChatStickerSet) ⇒ <code>Promise</code> * [.getForumTopicIconStickers(chatId, [options])](#TelegramBot+getForumTopicIconStickers) ⇒ <code>Promise</code> * [.createForumTopic(chatId, name, [options])](#TelegramBot+createForumTopic) * [.editForumTopic(chatId, messageThreadId, [options])](#TelegramBot+editForumTopic) ⇒ <code>Promise</code> * [.closeForumTopic(chatId, messageThreadId, [options])](#TelegramBot+closeForumTopic) ⇒ <code>Promise</code> * [.reopenForumTopic(chatId, messageThreadId, [options])](#TelegramBot+reopenForumTopic) ⇒ <code>Promise</code> * [.deleteForumTopic(chatId, messageThreadId, [options])](#TelegramBot+deleteForumTopic) ⇒ <code>Promise</code> * [.unpinAllForumTopicMessages(chatId, messageThreadId, [options])](#TelegramBot+unpinAllForumTopicMessages) ⇒ <code>Promise</code> * [.editGeneralForumTopic(chatId, name, [options])](#TelegramBot+editGeneralForumTopic) ⇒ <code>Promise</code> * [.closeGeneralForumTopic(chatId, [options])](#TelegramBot+closeGeneralForumTopic) ⇒ <code>Promise</code> * [.reopenGeneralForumTopic(chatId, [options])](#TelegramBot+reopenGeneralForumTopic) ⇒ <code>Promise</code> * [.hideGeneralForumTopic(chatId, [options])](#TelegramBot+hideGeneralForumTopic) ⇒ <code>Promise</code> * [.unhideGeneralForumTopic(chatId, [options])](#TelegramBot+unhideGeneralForumTopic) ⇒ <code>Promise</code> * [.unpinAllGeneralForumTopicMessages(chatId, [options])](#TelegramBot+unpinAllGeneralForumTopicMessages) ⇒ <code>Promise</code> * [.answerCallbackQuery(callbackQueryId, [options])](#TelegramBot+answerCallbackQuery) ⇒ <code>Promise</code> * [.getUserChatBoosts(chatId, user_id, [options])](#TelegramBot+getUserChatBoosts) ⇒ <code>Promise</code> * [.getBusinessConnection(businessConnectionId, [options])](#TelegramBot+getBusinessConnection) ⇒ <code>Promise</code> * [.setMyCommands(commands, [options])](#TelegramBot+setMyCommands) ⇒ <code>Promise</code> * [.deleteMyCommands([options])](#TelegramBot+deleteMyCommands) ⇒ <code>Promise</code> * [.getMyCommands([options])](#TelegramBot+getMyCommands) ⇒ <code>Promise</code> * [.setMyName([options])](#TelegramBot+setMyName) ⇒ <code>Promise</code> * [.getMyName([options])](#TelegramBot+getMyName) ⇒ <code>Promise</code> * [.setMyDescription([options])](#TelegramBot+setMyDescription) ⇒ <code>Promise</code> * [.getMyDescription([options])](#TelegramBot+getMyDescription) ⇒ <code>Promise</code> * [.setMyShortDescription([options])](#TelegramBot+setMyShortDescription) ⇒ <code>Promise</code> * [.getMyShortDescription([options])](#TelegramBot+getMyShortDescription) ⇒ <code>Promise</code> * [.setChatMenuButton([options])](#TelegramBot+setChatMenuButton) ⇒ <code>Promise</code> * [.getChatMenuButton([options])](#TelegramBot+getChatMenuButton) ⇒ <code>Promise</code> * [.setMyDefaultAdministratorRights([options])](#TelegramBot+setMyDefaultAdministratorRights) ⇒ <code>Promise</code> * [.getMyDefaultAdministratorRights([options])](#TelegramBot+getMyDefaultAdministratorRights) ⇒ <code>Promise</code> * [.editMessageText(text, [options])](#TelegramBot+editMessageText) ⇒ <code>Promise</code> * [.editMessageCaption(caption, [options])](#TelegramBot+editMessageCaption) ⇒ <code>Promise</code> * [.editMessageMedia(media, [options])](#TelegramBot+editMessageMedia) ⇒ <code>Promise</code> * [.editMessageReplyMarkup(replyMarkup, [options])](#TelegramBot+editMessageReplyMarkup) ⇒ <code>Promise</code> * [.stopPoll(chatId, pollId, [options])](#TelegramBot+stopPoll) ⇒ <code>Promise</code> * [.sendSticker(chatId, sticker, [options], [fileOptions])](#TelegramBot+sendSticker) ⇒ <code>Promise</code> * [.getStickerSet(name, [options])](#TelegramBot+getStickerSet) ⇒ <code>Promise</code> * [.getCustomEmojiStickers(custom_emoji_ids, [options])](#TelegramBot+getCustomEmojiStickers) ⇒ <code>Promise</code> * [.uploadStickerFile(userId, sticker, stickerFormat, [options], [fileOptions])](#TelegramBot+uploadStickerFile) ⇒ <code>Promise</code> * [.createNewStickerSet(userId, name, title, pngSticker, emojis, [options], [fileOptions])](#TelegramBot+createNewStickerSet) ⇒ <code>Promise</code> * [.addStickerToSet(userId, name, sticker, emojis, stickerType, [options], [fileOptions])](#TelegramBot+addStickerToSet) ⇒ <code>Promise</code> * [.setStickerPositionInSet(sticker, position, [options])](#TelegramBot+setStickerPositionInSet) ⇒ <code>Promise</code> * [.deleteStickerFromSet(sticker, [options])](#TelegramBot+deleteStickerFromSet) ⇒ <code>Promise</code> * [.replaceStickerInSet(user_id, name, sticker, [options])](#TelegramBot+replaceStickerInSet) ⇒ <code>Promise</code> * [.setStickerEmojiList(sticker, emojiList, [options])](#TelegramBot+setStickerEmojiList) ⇒ <code>Promise</code> * [.setStickerKeywords(sticker, [options])](#TelegramBot+setStickerKeywords) ⇒ <code>Promise</code> * [.setStickerMaskPosition(sticker, [options])](#TelegramBot+setStickerMaskPosition) ⇒ <code>Promise</code> * [.setStickerSetTitle(name, title, [options])](#TelegramBot+setStickerSetTitle) ⇒ <code>Promise</code> * [.setStickerSetThumbnail(userId, name, thumbnail, [options], [fileOptions])](#TelegramBot+setStickerSetThumbnail) ⇒ <code>Promise</code> * [.setCustomEmojiStickerSetThumbnail(name, [options])](#TelegramBot+setCustomEmojiStickerSetThumbnail) ⇒ <code>Promise</code> * [.deleteStickerSet(name, [options])](#TelegramBot+deleteStickerSet) ⇒ <code>Promise</code> * [.answerInlineQuery(inlineQueryId, results, [options])](#TelegramBot+answerInlineQuery) ⇒ <code>Promise</code> * [.answerWebAppQuery(webAppQueryId, result, [options])](#TelegramBot+answerWebAppQuery) ⇒ <code>Promise</code> * [.sendInvoice(chatId, title, description, payload, providerToken, currency, prices, [options])](#TelegramBot+sendInvoice) ⇒ <code>Promise</code> * [.createInvoiceLink(title, description, payload, providerToken, currency, prices, [options])](#TelegramBot+createInvoiceLink) ⇒ <code>Promise</code> * [.answerShippingQuery(shippingQueryId, ok, [options])](#TelegramBot+answerShippingQuery) ⇒ <code>Promise</code> * [.answerPreCheckoutQuery(preCheckoutQueryId, ok, [options])](#TelegramBot+answerPreCheckoutQuery) ⇒ <code>Promise</code> * [.sendGame(chatId, gameShortName, [options])](#TelegramBot+sendGame) ⇒ <code>Promise</code> * [.setGameScore(userId, score, [options])](#TelegramBot+setGameScore) ⇒ <code>Promise</code> * [.getGameHighScores(userId, [options])](#TelegramBot+getGameHighScores) ⇒ <code>Promise</code> * [.deleteMessage(chatId, messageId, [options])](#TelegramBot+deleteMessage) ⇒ <code>Promise</code> * [.deleteMessages(chatId, messageIds, [options])](#TelegramBot+deleteMessages) ⇒ <code>[ &#x27;Promise&#x27; ].&lt;Boolean&gt;</code> * _static_ * [.errors](#TelegramBot.errors) : <code>Object</code> * [.messageTypes](#TelegramBot.messageTypes) : <code>[ &#x27;Array&#x27; ].&lt;String&gt;</code> <a name="new_TelegramBot_new"></a> ### new TelegramBot(token, [options]) Both request method to obtain messages are implemented. To use standard polling, set `polling: true` on `options`. Notice that [webHook](https://core.telegram.org/bots/api#setwebhook) will need a SSL certificate. Emits `message` when a message arrives. | Param | Type | Default | Description | | --- | --- | --- | --- | | token | <code>String</code> | | Bot Token | | [options] | <code>Object</code> | | | | [options.polling] | <code>Boolean</code> \| <code>Object</code> | <code>false</code> | Set true to enable polling or set options. If a WebHook has been set, it will be deleted automatically. | | [options.polling.timeout] | <code>String</code> \| <code>Number</code> | <code>10</code> | *Deprecated. Use `options.polling.params` instead*. Timeout in seconds for long polling. | | [options.testEnvironment] | <code>Boolean</code> | <code>false</code> | Set true to work with test enviroment. When working with the test environment, you may use HTTP links without TLS to test your Web App. | | [options.polling.interval] | <code>String</code> \| <code>Number</code> | <code>300</code> | Interval between requests in miliseconds | | [options.polling.autoStart] | <code>Boolean</code> | <code>true</code> | Start polling immediately | | [options.polling.params] | <code>Object</code> | | Parameters to be used in polling API requests. See https://core.telegram.org/bots/api#getupdates for more information. | | [options.polling.params.timeout] | <code>Number</code> | <code>10</code> | Timeout in seconds for long polling. | | [options.webHook] | <code>Boolean</code> \| <code>Object</code> | <code>false</code> | Set true to enable WebHook or set options | | [options.webHook.host] | <code>String</code> | <code>&quot;0.0.0.0&quot;</code> | Host to bind to | | [options.webHook.port] | <code>Number</code> | <code>8443</code> | Port to bind to | | [options.webHook.key] | <code>String</code> | | Path to file with PEM private key for webHook server. The file is read **synchronously**! | | [options.webHook.cert] | <code>String</code> | | Path to file with PEM certificate (public) for webHook server. The file is read **synchronously**! | | [options.webHook.pfx] | <code>String</code> | | Path to file with PFX private key and certificate chain for webHook server. The file is read **synchronously**! | | [options.webHook.autoOpen] | <code>Boolean</code> | <code>true</code> | Open webHook immediately | | [options.webHook.https] | <code>Object</code> | | Options to be passed to `https.createServer()`. Note that `options.webHook.key`, `options.webHook.cert` and `options.webHook.pfx`, if provided, will be used to override `key`, `cert` and `pfx` in this object, respectively. See https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener for more information. | | [options.webHook.healthEndpoint] | <code>String</code> | <code>&quot;/healthz&quot;</code> | An endpoint for health checks that always responds with 200 OK | | [options.onlyFirstMatch] | <code>Boolean</code> | <code>false</code> | Set to true to stop after first match. Otherwise, all regexps are executed | | [options.request] | <code>Object</code> | | Options which will be added for all requests to telegram api. See https://github.com/request/request#requestoptions-callback for more information. | | [options.baseApiUrl] | <code>String</code> | <code>&quot;https://api.telegram.org&quot;</code> | API Base URl; useful for proxying and testing | | [options.filepath] | <code>Boolean</code> | <code>true</code> | Allow passing file-paths as arguments when sending files, such as photos using `TelegramBot#sendPhoto()`. See [usage information][usage-sending-files-performance] for more information on this option and its consequences. | | [options.badRejection] | <code>Boolean</code> | <code>false</code> | Set to `true` **if and only if** the Node.js version you're using terminates the process on unhandled rejections. This option is only for *forward-compatibility purposes*. | <a name="TelegramBot+on"></a> ### telegramBot.on(event, listener) Add listener for the specified [event](https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#events). This is the usual `emitter.on()` method. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **See** - [Available events](https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#events) - https://nodejs.org/api/events.html#events_emitter_on_eventname_listener | Param | Type | | --- | --- | | event | <code>String</code> | | listener | <code>function</code> | <a name="TelegramBot+startPolling"></a> ### telegramBot.startPolling([options]) ⇒ <code>Promise</code> Start polling. Rejects returned promise if a WebHook is being used by this instance. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) | Param | Type | Default | Description | | --- | --- | --- | --- | | [options] | <code>Object</code> | | | | [options.restart] | <code>Boolean</code> | <code>true</code> | Consecutive calls to this method causes polling to be restarted | <a name="TelegramBot+initPolling"></a> ### ~~telegramBot.initPolling([options]) ⇒ <code>Promise</code>~~ ***Deprecated*** Alias of `TelegramBot#startPolling()`. This is **deprecated**. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) | Param | Type | | --- | --- | | [options] | <code>Object</code> | <a name="TelegramBot+stopPolling"></a> ### telegramBot.stopPolling([options]) ⇒ <code>Promise</code> Stops polling after the last polling request resolves. Multiple invocations do nothing if polling is already stopped. Returning the promise of the last polling request is **deprecated**. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) | Param | Type | Description | | --- | --- | --- | | [options] | <code>Object</code> | Options | | [options.cancel] | <code>Boolean</code> | Cancel current request | | [options.reason] | <code>String</code> | Reason for stopping polling | <a name="TelegramBot+getFileLink"></a> ### telegramBot.getFileLink(fileId, [options]) ⇒ <code>Promise</code> Get link for file. Use this method to get link for file for subsequent use. Attention: link will be valid for 1 hour. This method is a sugar extension of the (getFile)[#getfilefileid] method, which returns just path to file on remote server (you will have to manually build full uri after that). **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Returns**: <code>Promise</code> - Promise which will have *fileURI* in resolve callback **See**: https://core.telegram.org/bots/api#getfile | Param | Type | Description | | --- | --- | --- | | fileId | <code>String</code> | File identifier to get info about | | [options] | <code>Object</code> | Additional Telegram query options | <a name="TelegramBot+getFileStream"></a> ### telegramBot.getFileStream(fileId, [options]) ⇒ <code>stream.Readable</code> Return a readable stream for file. `fileStream.path` is the specified file ID i.e. `fileId`. `fileStream` emits event `info` passing a single argument i.e. `info` with the interface `{ uri }` where `uri` is the URI of the file on Telegram servers. This method is a sugar extension of the [getFileLink](#TelegramBot+getFileLink) method, which returns the full URI to the file on remote server. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Returns**: <code>stream.Readable</code> - fileStream | Param | Type | Description | | --- | --- | --- | | fileId | <code>String</code> | File identifier to get info about | | [options] | <code>Object</code> | Additional Telegram query options | <a name="TelegramBot+downloadFile"></a> ### telegramBot.downloadFile(fileId, downloadDir, [options]) ⇒ <code>Promise</code> Downloads file in the specified folder. This method is a sugar extension of the [getFileStream](#TelegramBot+getFileStream) method, which returns a readable file stream. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Returns**: <code>Promise</code> - Promise, which will have *filePath* of downloaded file in resolve callback | Param | Type | Description | | --- | --- | --- | | fileId | <code>String</code> | File identifier to get info about | | downloadDir | <code>String</code> | Absolute path to the folder in which file will be saved | | [options] | <code>Object</code> | Additional Telegram query options | <a name="TelegramBot+onText"></a> ### telegramBot.onText(regexpRexecuted, callback) Register a RegExp to test against an incomming text message. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) | Param | Type | Description | | --- | --- | --- | | regexpRexecuted | <code>RegExp</code> | with `exec`. | | callback | <code>function</code> | Callback will be called with 2 parameters, the `msg` and the result of executing `regexp.exec` on message text. | <a name="TelegramBot+removeTextListener"></a> ### telegramBot.removeTextListener(regexp) ⇒ <code>Object</code> Remove a listener registered with `onText()`. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Returns**: <code>Object</code> - deletedListener The removed reply listener if found. This object has `regexp` and `callback` properties. If not found, returns `null`. | Param | Type | Description | | --- | --- | --- | | regexp | <code>RegExp</code> | RegExp used previously in `onText()` | <a name="TelegramBot+clearTextListeners"></a> ### telegramBot.clearTextListeners() Remove all listeners registered with `onText()`. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) <a name="TelegramBot+onReplyToMessage"></a> ### telegramBot.onReplyToMessage(chatId, messageId, callback) ⇒ <code>Number</code> Register a reply to wait for a message response. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Returns**: <code>Number</code> - id The ID of the inserted reply listener. | Param | Type | Description | | --- | --- | --- | | chatId | <code>Number</code> \| <code>String</code> | The chat id where the message cames from. | | messageId | <code>Number</code> \| <code>String</code> | The message id to be replied. | | callback | <code>function</code> | Callback will be called with the reply message. | <a name="TelegramBot+removeReplyListener"></a> ### telegramBot.removeReplyListener(replyListenerId) ⇒ <code>Object</code> Removes a reply that has been prev. registered for a message response. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Returns**: <code>Object</code> - deletedListener The removed reply listener if found. This object has `id`, `chatId`, `messageId` and `callback` properties. If not found, returns `null`. | Param | Type | Description | | --- | --- | --- | | replyListenerId | <code>Number</code> | The ID of the reply listener. | <a name="TelegramBot+clearReplyListeners"></a> ### telegramBot.clearReplyListeners() ⇒ <code>Array</code> Removes all replies that have been prev. registered for a message response. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Returns**: <code>Array</code> - deletedListeners An array of removed listeners. <a name="TelegramBot+isPolling"></a> ### telegramBot.isPolling() ⇒ <code>Boolean</code> Return true if polling. Otherwise, false. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) <a name="TelegramBot+openWebHook"></a> ### telegramBot.openWebHook() ⇒ <code>Promise</code> Open webhook. Multiple invocations do nothing if webhook is already open. Rejects returned promise if Polling is being used by this instance. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) <a name="TelegramBot+closeWebHook"></a> ### telegramBot.closeWebHook() ⇒ <code>Promise</code> Close webhook after closing all current connections. Multiple invocations do nothing if webhook is already closed. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Returns**: <code>Promise</code> - Promise <a name="TelegramBot+hasOpenWebHook"></a> ### telegramBot.hasOpenWebHook() ⇒ <code>Boolean</code> Return true if using webhook and it is open i.e. accepts connections. Otherwise, false. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) <a name="TelegramBot+processUpdate"></a> ### telegramBot.processUpdate(update) Process an update; emitting the proper events and executing regexp callbacks. This method is useful should you be using a different way to fetch updates, other than those provided by TelegramBot. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **See**: https://core.telegram.org/bots/api#update | Param | Type | | --- | --- | | update | <code>Object</code> | <a name="TelegramBot+getUpdates"></a> ### telegramBot.getUpdates([options]) ⇒ <code>Promise</code> Use this method to receive incoming updates using long polling. This method has an [older, compatible signature][getUpdates-v0.25.0] that is being deprecated. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **See**: https://core.telegram.org/bots/api#getupdates | Param | Type | Description | | --- | --- | --- | | [options] | <code>Object</code> | Additional Telegram query options | <a name="TelegramBot+setWebHook"></a> ### telegramBot.setWebHook(url, [options], [fileOptions]) ⇒ <code>Promise</code> Specify an url to receive incoming updates via an outgoing webHook. This method has an [older, compatible signature][setWebHook-v0.25.0] that is being deprecated. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **See** - https://core.telegram.org/bots/api#setwebhook - https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files | Param | Type | Description | | --- | --- | --- | | url | <code>String</code> | URL where Telegram will make HTTP Post. Leave empty to delete webHook. | | [options] | <code>Object</code> | Additional Telegram query options | | [options.certificate] | <code>String</code> \| <code>stream.Stream</code> | PEM certificate key (public). | | [options.secret_token] | <code>String</code> | Optional secret token to be sent in a header `X-Telegram-Bot-Api-Secret-Token` in every webhook request. | | [fileOptions] | <code>Object</code> | Optional file related meta-data | <a name="TelegramBot+deleteWebHook"></a> ### telegramBot.deleteWebHook([options]) ⇒ <code>Promise</code> Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **See**: https://core.telegram.org/bots/api#deletewebhook | Param | Type | Description | | --- | --- | --- | | [options] | <code>Object</code> | Additional Telegram query options | <a name="TelegramBot+getWebHookInfo"></a> ### telegramBot.getWebHookInfo([options]) ⇒ <code>Promise</code> Use this method to get current webhook status. On success, returns a [WebhookInfo](https://core.telegram.org/bots/api#webhookinfo) object. If the bot is using getUpdates, will return an object with the url field empty. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **See**: https://core.telegram.org/bots/api#getwebhookinfo | Param | Type | Description | | --- | --- | --- | | [options] | <code>Object</code> | Additional Telegram query options | <a name="TelegramBot+getMe"></a> ### telegramBot.getMe([options]) ⇒ <code>Promise</code> A simple method for testing your bot's authentication token. Requires no parameters. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Returns**: <code>Promise</code> - basic information about the bot in form of a [User](https://core.telegram.org/bots/api#user) object. **See**: https://core.telegram.org/bots/api#getme | Param | Type | Description | | --- | --- | --- | | [options] | <code>Object</code> | Additional Telegram query options | <a name="TelegramBot+logOut"></a> ### telegramBot.logOut([options]) ⇒ <code>Promise</code> This method log out your bot from the cloud Bot API server before launching the bot locally. You must log out the bot before running it locally, otherwise there is no guarantee that the bot will receive updates. After a successful call, you will not be able to log in again using the same token for 10 minutes. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Returns**: <code>Promise</code> - True on success **See**: https://core.telegram.org/bots/api#logout | Param | Type | Description | | --- | --- | --- | | [options] | <code>Object</code> | Additional Telegram query options | <a name="TelegramBot+close"></a> ### telegramBot.close([options]) ⇒ <code>Promise</code> This method close the bot instance before moving it from one local server to another. This method will return error 429 in the first 10 minutes after the bot is launched. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Returns**: <code>Promise</code> - True on success **See**: https://core.telegram.org/bots/api#close | Param | Type | Description | | --- | --- | --- | | [options] | <code>Object</code> | Additional Telegram query options | <a name="TelegramBot+sendMessage"></a> ### telegramBot.sendMessage(chatId, text, [options]) ⇒ <code>Promise</code> Send text message. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Returns**: <code>Promise</code> - On success, the sent [Message](https://core.telegram.org/bots/api#message) object is returned **See**: https://core.telegram.org/bots/api#sendmessage | Param | Type | Description | | --- | --- | --- | | chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) | | text | <code>String</code> | Text of the message to be sent | | [options] | <code>Object</code> | Additional Telegram query options | <a name="TelegramBot+forwardMessage"></a> ### telegramBot.forwardMessage(chatId, fromChatId, messageId, [options]) ⇒ <code>Promise</code> Forward messages of any kind. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **See**: https://core.telegram.org/bots/api#forwardmessage | Param | Type | Description | | --- | --- | --- | | chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) or username of the target channel (in the format `@channelusername`) | | fromChatId | <code>Number</code> \| <code>String</code> | Unique identifier for the chat where the original message was sent (or channel username in the format `@channelusername`) | | messageId | <code>Number</code> \| <code>String</code> | Unique message identifier in the chat specified in fromChatId | | [options] | <code>Object</code> | Additional Telegram query options | <a name="TelegramBot+forwardMessages"></a> ### telegramBot.forwardMessages(chatId, fromChatId, messageIds, [options]) ⇒ <code>Promise</code> 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. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Returns**: <code>Promise</code> - An array of MessageId of the sent messages on success **See**: https://core.telegram.org/bots/api#forwardmessages | Param | Type | Description | | --- | --- | --- | | chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) or username of the target channel (in the format `@channelusername`) | | fromChatId | <code>Number</code> \| <code>String</code> | Unique identifier for the chat where the original message was sent (or channel username in the format `@channelusername`) | | messageIds | <code>[ &#x27;Array&#x27; ].&lt;(Number\|String)&gt;</code> | Identifiers of 1-100 messages in the chat from_chat_id to forward. The identifiers must be specified in a strictly increasing order. | | [options] | <code>Object</code> | Additional Telegram query options | <a name="TelegramBot+copyMessage"></a> ### telegramBot.copyMessage(chatId, fromChatId, messageId, [options]) ⇒ <code>Promise</code> Copy messages of any kind. **Service messages and invoice messages can't be copied.** The method is analogous to the method forwardMessages, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Returns**: <code>Promise</code> - The [MessageId](https://core.telegram.org/bots/api#messageid) of the sent message on success **See**: https://core.telegram.org/bots/api#copymessage | Param | Type | Description | | --- | --- | --- | | chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) | | fromChatId | <code>Number</code> \| <code>String</code> | Unique identifier for the chat where the original message was sent | | messageId | <code>Number</code> \| <code>String</code> | Unique message identifier | | [options] | <code>Object</code> | Additional Telegram query options | <a name="TelegramBot+copyMessages"></a> ### telegramBot.copyMessages(chatId, fromChatId, messageIds, [options]) ⇒ <code>Promise</code> 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. Returns the MessageId of the sent message on success. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Returns**: <code>Promise</code> - An array of MessageId of the sent messages **See**: https://core.telegram.org/bots/api#copymessages | Param | Type | Description | | --- | --- | --- | | chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target chat | | fromChatId | <code>Number</code> \| <code>String</code> | Unique identifier for the chat where the original message was sent | | messageIds | <code>Array</code> | Identifiers of 1-100 messages in the chat from_chat_id to copy. The identifiers must be specified in a strictly increasing order. | | [options] | <code>Object</code> | Additional Telegram query options | <a name="TelegramBot+sendPhoto"></a> ### telegramBot.sendPhoto(chatId, photo, [options], [fileOptions]) ⇒ <code>Promise</code> Send photo **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Returns**: <code>Promise</code> - On success, the sent [Message](https://core.telegram.org/bots/api#message) object is returned **See** - https://core.telegram.org/bots/api#sendphoto - https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files | Param | Type | Description | | --- | --- | --- | | chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) | | photo | <code>String</code> \| <code>stream.Stream</code> \| <code>Buffer</code> | A file path or a Stream. Can also be a `file_id` previously uploaded | | [options] | <code>Object</code> | Additional Telegram query options | | [fileOptions] | <code>Object</code> | Optional file related meta-data | <a name="TelegramBot+sendAudio"></a> ### telegramBot.sendAudio(chatId, audio, [options], [fileOptions]) ⇒ <code>Promise</code> Send audio **Your audio must be in the .MP3 or .M4A format.** **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Returns**: <code>Promise</code> - On success, the sent [Message](https://core.telegram.org/bots/api#message) object is returned **See** - https://core.telegram.org/bots/api#sendaudio - https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files | Param | Type | Description | | --- | --- | --- | | chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) | | audio | <code>String</code> \| <code>stream.Stream</code> \| <code>Buffer</code> | A file path, Stream or Buffer. Can also be a `file_id` previously uploaded. | | [options] | <code>Object</code> | Additional Telegram query options | | [fileOptions] | <code>Object</code> | Optional file related meta-data | <a name="TelegramBot+sendDocument"></a> ### telegramBot.sendDocument(chatId, doc, [options], [fileOptions]) ⇒ <code>Promise</code> Send Document **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Returns**: <code>Promise</code> - On success, the sent [Message](https://core.telegram.org/bots/api#message) object is returned **See** - https://core.telegram.org/bots/api#sendDocument - https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files | Param | Type | Description | | --- | --- | --- | | chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) | | doc | <code>String</code> \| <code>stream.Stream</code> \| <code>Buffer</code> | A file path, Stream or Buffer. Can also be a `file_id` previously uploaded. | | [options] | <code>Object</code> | Additional Telegram query options | | [fileOptions] | <code>Object</code> | Optional file related meta-data | <a name="TelegramBot+sendVideo"></a> ### telegramBot.sendVideo(chatId, video, [options], [fileOptions]) ⇒ <code>Promise</code> Use this method to send video files, **Telegram clients support mp4 videos** (other formats may be sent as Document). **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Returns**: <code>Promise</code> - On success, the sent [Message](https://core.telegram.org/bots/api#message) object is returned **See** - https://core.telegram.org/bots/api#sendvideo - https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files | Param | Type | Description | | --- | --- | --- | | chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) | | video | <code>String</code> \| <code>stream.Stream</code> \| <code>Buffer</code> | A file path or Stream. Can also be a `file_id` previously uploaded. | | [options] | <code>Object</code> | Additional Telegram query options | | [fileOptions] | <code>Object</code> | Optional file related meta-data | <a name="TelegramBot+sendAnimation"></a> ### telegramBot.sendAnimation(chatId, animation, [options], [fileOptions]) ⇒ <code>Promise</code> Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Returns**: <code>Promise</code> - On success, the sent [Message](https://core.telegram.org/bots/api#message) object is returned **See** - https://core.telegram.org/bots/api#sendanimation - https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files | Param | Type | Description | | --- | --- | --- | | chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) | | animation | <code>String</code> \| <code>stream.Stream</code> \| <code>Buffer</code> | A file path, Stream or Buffer. Can also be a `file_id` previously uploaded. | | [options] | <code>Object</code> | Additional Telegram query options | | [fileOptions] | <code>Object</code> | Optional file related meta-data | <a name="TelegramBot+sendVoice"></a> ### telegramBot.sendVoice(chatId, voice, [options], [fileOptions]) ⇒ <code>Promise</code> Send voice **Your audio must be in an .OGG file encoded with OPUS**, or in .MP3 format, or in .M4A format (other formats may be sent as Audio or Document) **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Returns**: <code>Promise</code> - On success, the sent [Message](https://core.telegram.org/bots/api#message) object is returned **See** - https://core.telegram.org/bots/api#sendvoice - https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files | Param | Type | Description | | --- | --- | --- | | chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) | | voice | <code>String</code> \| <code>stream.Stream</code> \| <code>Buffer</code> | A file path, Stream or Buffer. Can also be a `file_id` previously uploaded. | | [options] | <code>Object</code> | Additional Telegram query options | | [fileOptions] | <code>Object</code> | Optional file related meta-data | <a name="TelegramBot+sendVideoNote"></a> ### telegramBot.sendVideoNote(chatId, videoNote, [options], [fileOptions]) ⇒ <code>Promise</code> Use this method to send video messages Telegram clients support **rounded square MPEG4 videos** of up to 1 minute long. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Returns**: <code>Promise</code> - On success, the sent [Message](https://core.telegram.org/bots/api#message) object is returned **Info**: The length parameter is actually optional. However, the API (at time of writing) requires you to always provide it until it is fixed. **See** - https://core.telegram.org/bots/api#sendvideonote - https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files | Param | Type | Description | | --- | --- | --- | | chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) | | videoNote | <code>String</code> \| <code>stream.Stream</code> \| <code>Buffer</code> | A file path or Stream. Can also be a `file_id` previously uploaded. | | [options] | <code>Object</code> | Additional Telegram query options | | [fileOptions] | <code>Object</code> | Optional file related meta-data | <a name="TelegramBot+sendMediaGroup"></a> ### telegramBot.sendMediaGroup(chatId, media, [options]) ⇒ <code>Promise</code> Use this method to send a group of photos or videos as an album. **Documents and audio files can be only grouped in an album with messages of the same type** If you wish to [specify file options](https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files), add a `fileOptions` property to the target input in `media`. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Returns**: <code>Promise</code> - On success, an array of the sent [Messages](https://core.telegram.org/bots/api#message) is returned. **See** - https://core.telegram.org/bots/api#sendmediagroup - https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#sending-files | Param | Type | Description | | --- | --- | --- | | chatId | <code>String</code> | Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) | | media | <code>Array</code> | A JSON-serialized array describing photos and videos to be sent, must include 2–10 items | | [options] | <code>Object</code> | Additional Telegram query options | <a name="TelegramBot+sendLocation"></a> ### telegramBot.sendLocation(chatId, latitude, longitude, [options]) ⇒ <code>Promise</code> Send location. Use this method to send point on the map. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Returns**: <code>Promise</code> - On success, the sent [Message](https://core.telegram.org/bots/api#message) object is returned **See**: https://core.telegram.org/bots/api#sendlocation | Param | Type | Description | | --- | --- | --- | | chatId | <code>Number</code> \| <code>String</code> | Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) | | latitude | <code>Float</code> | Latitude of location | | longitude | <code>Float</code> | Longitude of location | | [options] | <code>Object</code> | Additional Telegram query options | <a name="TelegramBot+editMessageLiveLocation"></a> ### telegramBot.editMessageLiveLocation(latitude, longitude, [options]) ⇒ <code>Promise</code> Use this method to edit live location messages sent by the bot or via the bot (for inline bots). A location **can be edited until its live_period expires or editing is explicitly disabled by a call to [stopMessageLiveLocation](https://core.telegram.org/bots/api#stopmessagelivelocation)** Note that you must provide one of chat_id, message_id, or inline_message_id in your request. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Returns**: <code>Promise</code> - On success, if the edited message is not an inline message, the edited [Message](https://core.telegram.org/bots/api#message) is returned, otherwise True is returned. **See**: https://core.telegram.org/bots/api#editmessagelivelocation | Param | Type | Description | | --- | --- | --- | | latitude | <code>Float</code> | Latitude of location | | longitude | <code>Float</code> | Longitude of location | | [options] | <code>Object</code> | Additional Telegram query options (provide either one of chat_id, message_id, or inline_message_id here) | <a name="TelegramBot+stopMessageLiveLocation"></a> ### telegramBot.stopMessageLiveLocation([options]) ⇒ <code>Promise</code> Use this method to stop updating a live location message sent by the bot or via the bot (for inline bots) before live_period expires. Note that you must provide one of chat_id, message_id, or inline_message_id in your request. **Kind**: instance method of [<code>TelegramBot</code>](#TelegramBot) **Returns**: <code>Promise</code> - On success, if the edited message is not an inline message, the edited [Message](https://core.telegram.org/bots/api#message) is retu