# API Reference **Note:** If you are looking for available [events](usage.md#events) or usage of api, please refer [`usage.md`](usage.md). ## 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) ⇒ Promise * ~~[.initPolling([options])](#TelegramBot+initPolling) ⇒ Promise~~ * [.stopPolling([options])](#TelegramBot+stopPolling) ⇒ Promise * [.isPolling()](#TelegramBot+isPolling) ⇒ Boolean * [.openWebHook()](#TelegramBot+openWebHook) ⇒ Promise * [.closeWebHook()](#TelegramBot+closeWebHook) ⇒ Promise * [.hasOpenWebHook()](#TelegramBot+hasOpenWebHook) ⇒ Boolean * [.getMe([options])](#TelegramBot+getMe) ⇒ Promise * [.setWebHook(url, [options], [fileOptions])](#TelegramBot+setWebHook) ⇒ Promise * [.deleteWebHook([options])](#TelegramBot+deleteWebHook) ⇒ Promise * [.getWebHookInfo([options])](#TelegramBot+getWebHookInfo) ⇒ Promise * [.getUpdates([options])](#TelegramBot+getUpdates) ⇒ Promise * [.processUpdate(update)](#TelegramBot+processUpdate) * [.sendMessage(chatId, text, [options])](#TelegramBot+sendMessage) ⇒ Promise * [.answerInlineQuery(inlineQueryId, results, [options])](#TelegramBot+answerInlineQuery) ⇒ Promise * [.forwardMessage(chatId, fromChatId, messageId, [options])](#TelegramBot+forwardMessage) ⇒ Promise * [.sendPhoto(chatId, photo, [options], [fileOptions])](#TelegramBot+sendPhoto) ⇒ Promise * [.sendAudio(chatId, audio, [options], [fileOptions])](#TelegramBot+sendAudio) ⇒ Promise * [.sendDocument(chatId, doc, [options], [fileOptions])](#TelegramBot+sendDocument) ⇒ Promise * [.sendSticker(chatId, sticker, [options], [fileOptions])](#TelegramBot+sendSticker) ⇒ Promise * [.sendVideo(chatId, video, [options], [fileOptions])](#TelegramBot+sendVideo) ⇒ Promise * [.sendAnimation(chatId, animation, [options], [fileOptions])](#TelegramBot+sendAnimation) ⇒ Promise * [.sendVideoNote(chatId, videoNote, [options], [fileOptions])](#TelegramBot+sendVideoNote) ⇒ Promise * [.sendVoice(chatId, voice, [options], [fileOptions])](#TelegramBot+sendVoice) ⇒ Promise * [.sendChatAction(chatId, action, [options])](#TelegramBot+sendChatAction) ⇒ Promise * [.kickChatMember(chatId, userId, [options])](#TelegramBot+kickChatMember) ⇒ Promise * [.unbanChatMember(chatId, userId, [options])](#TelegramBot+unbanChatMember) ⇒ Promise * [.restrictChatMember(chatId, userId, [options])](#TelegramBot+restrictChatMember) ⇒ Promise * [.promoteChatMember(chatId, userId, [options])](#TelegramBot+promoteChatMember) ⇒ Promise * [.exportChatInviteLink(chatId, [options])](#TelegramBot+exportChatInviteLink) ⇒ Promise * [.setChatPhoto(chatId, photo, [options], [fileOptions])](#TelegramBot+setChatPhoto) ⇒ Promise * [.deleteChatPhoto(chatId, [options])](#TelegramBot+deleteChatPhoto) ⇒ Promise * [.setChatTitle(chatId, title, [options])](#TelegramBot+setChatTitle) ⇒ Promise * [.setChatDescription(chatId, description, [options])](#TelegramBot+setChatDescription) ⇒ Promise * [.pinChatMessage(chatId, messageId, [options])](#TelegramBot+pinChatMessage) ⇒ Promise * [.unpinChatMessage(chatId, [options])](#TelegramBot+unpinChatMessage) ⇒ Promise * [.answerCallbackQuery(callbackQueryId, [options])](#TelegramBot+answerCallbackQuery) ⇒ Promise * [.editMessageText(text, [options])](#TelegramBot+editMessageText) ⇒ Promise * [.editMessageCaption(caption, [options])](#TelegramBot+editMessageCaption) ⇒ Promise * [.editMessageMedia(media, [options])](#TelegramBot+editMessageMedia) ⇒ Promise * [.editMessageReplyMarkup(replyMarkup, [options])](#TelegramBot+editMessageReplyMarkup) ⇒ Promise * [.getUserProfilePhotos(userId, [options])](#TelegramBot+getUserProfilePhotos) ⇒ Promise * [.sendLocation(chatId, latitude, longitude, [options])](#TelegramBot+sendLocation) ⇒ Promise * [.editMessageLiveLocation(latitude, longitude, [options])](#TelegramBot+editMessageLiveLocation) ⇒ Promise * [.stopMessageLiveLocation([options])](#TelegramBot+stopMessageLiveLocation) ⇒ Promise * [.sendVenue(chatId, latitude, longitude, title, address, [options])](#TelegramBot+sendVenue) ⇒ Promise * [.sendContact(chatId, phoneNumber, firstName, [options])](#TelegramBot+sendContact) ⇒ Promise * [.sendPoll(chatId, question, pollOptions, [options])](#TelegramBot+sendPoll) ⇒ Promise * [.stopPoll(chatId, pollId, [options])](#TelegramBot+stopPoll) ⇒ Promise * [.getFile(fileId, [options])](#TelegramBot+getFile) ⇒ Promise * [.getFileLink(fileId, [options])](#TelegramBot+getFileLink) ⇒ Promise * [.getFileStream(fileId, [options])](#TelegramBot+getFileStream) ⇒ stream.Readable * [.downloadFile(fileId, downloadDir, [options])](#TelegramBot+downloadFile) ⇒ Promise * [.onText(regexp, callback)](#TelegramBot+onText) * [.removeTextListener(regexp)](#TelegramBot+removeTextListener) ⇒ Object * [.onReplyToMessage(chatId, messageId, callback)](#TelegramBot+onReplyToMessage) ⇒ Number * [.removeReplyListener(replyListenerId)](#TelegramBot+removeReplyListener) ⇒ Object * [.getChat(chatId, [options])](#TelegramBot+getChat) ⇒ Promise * [.getChatAdministrators(chatId, [options])](#TelegramBot+getChatAdministrators) ⇒ Promise * [.getChatMembersCount(chatId, [options])](#TelegramBot+getChatMembersCount) ⇒ Promise * [.getChatMember(chatId, userId, [options])](#TelegramBot+getChatMember) ⇒ Promise * [.leaveChat(chatId, [options])](#TelegramBot+leaveChat) ⇒ Promise * [.setChatStickerSet(chatId, stickerSetName, [options])](#TelegramBot+setChatStickerSet) ⇒ Promise * [.deleteChatStickerSet(chatId, [options])](#TelegramBot+deleteChatStickerSet) ⇒ Promise * [.sendGame(chatId, gameShortName, [options])](#TelegramBot+sendGame) ⇒ Promise * [.setGameScore(userId, score, [options])](#TelegramBot+setGameScore) ⇒ Promise * [.getGameHighScores(userId, [options])](#TelegramBot+getGameHighScores) ⇒ Promise * [.deleteMessage(chatId, messageId, [options])](#TelegramBot+deleteMessage) ⇒ Promise * [.sendInvoice(chatId, title, description, payload, providerToken, startParameter, currency, prices, [options])](#TelegramBot+sendInvoice) ⇒ Promise * [.answerShippingQuery(shippingQueryId, ok, [options])](#TelegramBot+answerShippingQuery) ⇒ Promise * [.answerPreCheckoutQuery(preCheckoutQueryId, ok, [options])](#TelegramBot+answerPreCheckoutQuery) ⇒ Promise * [.getStickerSet(name, [options])](#TelegramBot+getStickerSet) ⇒ Promise * [.uploadStickerFile(userId, pngSticker, [options], [fileOptions])](#TelegramBot+uploadStickerFile) ⇒ Promise * [.createNewStickerSet(userId, name, title, pngSticker, emojis, [options], [fileOptions])](#TelegramBot+createNewStickerSet) ⇒ Promise * [.addStickerToSet(userId, name, pngSticker, emojis, [options], [fileOptions])](#TelegramBot+addStickerToSet) ⇒ Promise * [.setStickerPositionInSet(sticker, position, [options])](#TelegramBot+setStickerPositionInSet) ⇒ Promise * [.deleteStickerFromSet(sticker, [options])](#TelegramBot+deleteStickerFromSet) ⇒ Promise * [.sendMediaGroup(chatId, media, [options])](#TelegramBot+sendMediaGroup) ⇒ Promise * _static_ * [.errors](#TelegramBot.errors) : Object * [.messageTypes](#TelegramBot.messageTypes) : Array.<String> * [.Promise](#TelegramBot.Promise) ### 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 | String | | Bot Token | | [options] | Object | | | | [options.polling] | Boolean \| Object | false | Set true to enable polling or set options. If a WebHook has been set, it will be deleted automatically. | | [options.polling.timeout] | String \| Number | 10 | *Deprecated. Use `options.polling.params` instead*. Timeout in seconds for long polling. | | [options.polling.interval] | String \| Number | 300 | Interval between requests in miliseconds | | [options.polling.autoStart] | Boolean | true | Start polling immediately | | [options.polling.params] | Object | | Parameters to be used in polling API requests. See https://core.telegram.org/bots/api#getupdates for more information. | | [options.polling.params.timeout] | Number | 10 | Timeout in seconds for long polling. | | [options.webHook] | Boolean \| Object | false | Set true to enable WebHook or set options | | [options.webHook.host] | String | "0.0.0.0" | Host to bind to | | [options.webHook.port] | Number | 8443 | Port to bind to | | [options.webHook.key] | String | | Path to file with PEM private key for webHook server. The file is read **synchronously**! | | [options.webHook.cert] | String | | Path to file with PEM certificate (public) for webHook server. The file is read **synchronously**! | | [options.webHook.pfx] | String | | Path to file with PFX private key and certificate chain for webHook server. The file is read **synchronously**! | | [options.webHook.autoOpen] | Boolean | true | Open webHook immediately | | [options.webHook.https] | Object | | 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] | String | "/healthz" | An endpoint for health checks that always responds with 200 OK | | [options.onlyFirstMatch] | Boolean | false | Set to true to stop after first match. Otherwise, all regexps are executed | | [options.request] | Object | | Options which will be added for all requests to telegram api. See https://github.com/request/request#requestoptions-callback for more information. | | [options.baseApiUrl] | String | "https://api.telegram.org" | API Base URl; useful for proxying and testing | | [options.filepath] | Boolean | true | 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] | Boolean | false | 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*. | ### 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 [TelegramBot](#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 | String | | listener | function | ### telegramBot.startPolling([options]) ⇒ Promise Start polling. Rejects returned promise if a WebHook is being used by this instance. **Kind**: instance method of [TelegramBot](#TelegramBot) | Param | Type | Default | Description | | --- | --- | --- | --- | | [options] | Object | | | | [options.restart] | Boolean | true | Consecutive calls to this method causes polling to be restarted | ### ~~telegramBot.initPolling([options]) ⇒ Promise~~ ***Deprecated*** Alias of `TelegramBot#startPolling()`. This is **deprecated**. **Kind**: instance method of [TelegramBot](#TelegramBot) | Param | Type | | --- | --- | | [options] | Object | ### telegramBot.stopPolling([options]) ⇒ Promise 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 [TelegramBot](#TelegramBot) | Param | Type | Description | | --- | --- | --- | | [options] | Object | Options | | [options.cancel] | Boolean | Cancel current request | | [options.reason] | String | Reason for stopping polling | ### telegramBot.isPolling() ⇒ Boolean Return true if polling. Otherwise, false. **Kind**: instance method of [TelegramBot](#TelegramBot) ### telegramBot.openWebHook() ⇒ Promise 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 [TelegramBot](#TelegramBot) ### telegramBot.closeWebHook() ⇒ Promise Close webhook after closing all current connections. Multiple invocations do nothing if webhook is already closed. **Kind**: instance method of [TelegramBot](#TelegramBot) **Returns**: Promise - promise ### telegramBot.hasOpenWebHook() ⇒ Boolean Return true if using webhook and it is open i.e. accepts connections. Otherwise, false. **Kind**: instance method of [TelegramBot](#TelegramBot) ### telegramBot.getMe([options]) ⇒ Promise Returns basic information about the bot in form of a `User` object. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#getme | Param | Type | Description | | --- | --- | --- | | [options] | Object | Additional Telegram query options | ### telegramBot.setWebHook(url, [options], [fileOptions]) ⇒ Promise 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 [TelegramBot](#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 | String | URL where Telegram will make HTTP Post. Leave empty to delete webHook. | | [options] | Object | Additional Telegram query options | | [options.certificate] | String \| stream.Stream | PEM certificate key (public). | | [fileOptions] | Object | Optional file related meta-data | ### telegramBot.deleteWebHook([options]) ⇒ Promise Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#deletewebhook | Param | Type | Description | | --- | --- | --- | | [options] | Object | Additional Telegram query options | ### telegramBot.getWebHookInfo([options]) ⇒ Promise 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 [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#getwebhookinfo | Param | Type | Description | | --- | --- | --- | | [options] | Object | Additional Telegram query options | ### telegramBot.getUpdates([options]) ⇒ Promise 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 [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#getupdates | Param | Type | Description | | --- | --- | --- | | [options] | Object | Additional Telegram query options | ### 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 [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#update | Param | Type | | --- | --- | | update | Object | ### telegramBot.sendMessage(chatId, text, [options]) ⇒ Promise Send text message. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#sendmessage | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | Unique identifier for the message recipient | | text | String | Text of the message to be sent | | [options] | Object | Additional Telegram query options | ### telegramBot.answerInlineQuery(inlineQueryId, results, [options]) ⇒ Promise Send answers to an inline query. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#answerinlinequery | Param | Type | Description | | --- | --- | --- | | inlineQueryId | String | Unique identifier of the query | | results | Array.<InlineQueryResult> | An array of results for the inline query | | [options] | Object | Additional Telegram query options | ### telegramBot.forwardMessage(chatId, fromChatId, messageId, [options]) ⇒ Promise Forward messages of any kind. **Kind**: instance method of [TelegramBot](#TelegramBot) | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | Unique identifier for the message recipient | | fromChatId | Number \| String | Unique identifier for the chat where the original message was sent | | messageId | Number \| String | Unique message identifier | | [options] | Object | Additional Telegram query options | ### telegramBot.sendPhoto(chatId, photo, [options], [fileOptions]) ⇒ Promise Send photo **Kind**: instance method of [TelegramBot](#TelegramBot) **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 | Number \| String | Unique identifier for the message recipient | | photo | String \| stream.Stream \| Buffer | A file path or a Stream. Can also be a `file_id` previously uploaded | | [options] | Object | Additional Telegram query options | | [fileOptions] | Object | Optional file related meta-data | ### telegramBot.sendAudio(chatId, audio, [options], [fileOptions]) ⇒ Promise Send audio **Kind**: instance method of [TelegramBot](#TelegramBot) **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 | Number \| String | Unique identifier for the message recipient | | audio | String \| stream.Stream \| Buffer | A file path, Stream or Buffer. Can also be a `file_id` previously uploaded. | | [options] | Object | Additional Telegram query options | | [fileOptions] | Object | Optional file related meta-data | ### telegramBot.sendDocument(chatId, doc, [options], [fileOptions]) ⇒ Promise Send Document **Kind**: instance method of [TelegramBot](#TelegramBot) **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 | Number \| String | Unique identifier for the message recipient | | doc | String \| stream.Stream \| Buffer | A file path, Stream or Buffer. Can also be a `file_id` previously uploaded. | | [options] | Object | Additional Telegram query options | | [fileOptions] | Object | Optional file related meta-data | ### telegramBot.sendSticker(chatId, sticker, [options], [fileOptions]) ⇒ Promise Send .webp stickers. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#sendsticker | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | Unique identifier for the message recipient | | sticker | String \| stream.Stream \| Buffer | A file path, Stream or Buffer. Can also be a `file_id` previously uploaded. Stickers are WebP format files. | | [options] | Object | Additional Telegram query options | | [fileOptions] | Object | Optional file related meta-data | ### telegramBot.sendVideo(chatId, video, [options], [fileOptions]) ⇒ Promise Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document). **Kind**: instance method of [TelegramBot](#TelegramBot) **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 | Number \| String | Unique identifier for the message recipient | | video | String \| stream.Stream \| Buffer | A file path or Stream. Can also be a `file_id` previously uploaded. | | [options] | Object | Additional Telegram query options | | [fileOptions] | Object | Optional file related meta-data | ### telegramBot.sendAnimation(chatId, animation, [options], [fileOptions]) ⇒ Promise Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound). **Kind**: instance method of [TelegramBot](#TelegramBot) **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 | Number \| String | Unique identifier for the message recipient | | animation | String \| stream.Stream \| Buffer | A file path, Stream or Buffer. Can also be a `file_id` previously uploaded. | | [options] | Object | Additional Telegram query options | | [fileOptions] | Object | Optional file related meta-data | ### telegramBot.sendVideoNote(chatId, videoNote, [options], [fileOptions]) ⇒ Promise Use this method to send rounded square videos of upto 1 minute long. **Kind**: instance method of [TelegramBot](#TelegramBot) **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 | Number \| String | Unique identifier for the message recipient | | videoNote | String \| stream.Stream \| Buffer | A file path or Stream. Can also be a `file_id` previously uploaded. | | [options] | Object | Additional Telegram query options | | [fileOptions] | Object | Optional file related meta-data | ### telegramBot.sendVoice(chatId, voice, [options], [fileOptions]) ⇒ Promise Send voice **Kind**: instance method of [TelegramBot](#TelegramBot) **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 | Number \| String | Unique identifier for the message recipient | | voice | String \| stream.Stream \| Buffer | A file path, Stream or Buffer. Can also be a `file_id` previously uploaded. | | [options] | Object | Additional Telegram query options | | [fileOptions] | Object | Optional file related meta-data | ### telegramBot.sendChatAction(chatId, action, [options]) ⇒ Promise Send chat action. `typing` for text messages, `upload_photo` for photos, `record_video` or `upload_video` for videos, `record_audio` or `upload_audio` for audio files, `upload_document` for general files, `find_location` for location data. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#sendchataction | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | Unique identifier for the message recipient | | action | String | Type of action to broadcast. | | [options] | Object | Additional Telegram query options | ### telegramBot.kickChatMember(chatId, userId, [options]) ⇒ Promise Use this method to kick a user from a group or a supergroup. In the case of supergroups, 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 group for this to work. Returns True on success. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#kickchatmember | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | Unique identifier for the target group or username of the target supergroup | | userId | Number | Unique identifier of the target user | | [options] | Object | Additional Telegram query options | ### telegramBot.unbanChatMember(chatId, userId, [options]) ⇒ Promise Use this method to unban a previously kicked user in a supergroup. The user will not return to the group automatically, but will be able to join via link, etc. The bot must be an administrator in the group for this to work. Returns True on success. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#unbanchatmember | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | Unique identifier for the target group or username of the target supergroup | | userId | Number | Unique identifier of the target user | | [options] | Object | Additional Telegram query options | ### telegramBot.restrictChatMember(chatId, userId, [options]) ⇒ Promise Use this method to 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. Returns True on success. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#restrictchatmember | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | Unique identifier for the target chat or username of the target supergroup | | userId | Number | Unique identifier of the target user | | [options] | Object | Additional Telegram query options | ### telegramBot.promoteChatMember(chatId, userId, [options]) ⇒ Promise Use this method to 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. Returns True on success. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#promotechatmember | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | Unique identifier for the target chat or username of the target supergroup | | userId | Number | | | [options] | Object | Additional Telegram query options | ### telegramBot.exportChatInviteLink(chatId, [options]) ⇒ Promise Use this method to 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. Returns exported invite link as String on success. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#exportchatinvitelink | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | Unique identifier for the target chat or username of the target supergroup | | [options] | Object | Additional Telegram query options | ### telegramBot.setChatPhoto(chatId, photo, [options], [fileOptions]) ⇒ Promise Use this method to set a new profile photo for the chat. Photos 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. Returns True on success. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#setchatphoto | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | Unique identifier for the message recipient | | photo | stream.Stream \| Buffer | A file path or a Stream. | | [options] | Object | Additional Telegram query options | | [fileOptions] | Object | Optional file related meta-data | ### telegramBot.deleteChatPhoto(chatId, [options]) ⇒ Promise Use this method to delete a chat photo. Photos 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. Returns True on success. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#deletechatphoto | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | Unique identifier for the message recipient | | [options] | Object | Additional Telegram query options | ### telegramBot.setChatTitle(chatId, title, [options]) ⇒ Promise Use this method to 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. Returns True on success. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#setchattitle | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | Unique identifier for the message recipient | | title | String | New chat title, 1-255 characters | | [options] | Object | Additional Telegram query options | ### telegramBot.setChatDescription(chatId, description, [options]) ⇒ Promise Use this method to change the description of 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. Returns True on success. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#setchatdescription | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | Unique identifier for the message recipient | | description | String | New chat title, 1-255 characters | | [options] | Object | Additional Telegram query options | ### telegramBot.pinChatMessage(chatId, messageId, [options]) ⇒ Promise Use this method to pin a message in a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#pinchatmessage | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | Unique identifier for the message recipient | | messageId | Number | Identifier of a message to pin | | [options] | Object | Additional Telegram query options | ### telegramBot.unpinChatMessage(chatId, [options]) ⇒ Promise Use this method to unpin a message in a supergroup chat. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#unpinchatmessage | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | Unique identifier for the message recipient | | [options] | Object | Additional Telegram query options | ### telegramBot.answerCallbackQuery(callbackQueryId, [options]) ⇒ Promise Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned. This method has **older, compatible signatures ([1][answerCallbackQuery-v0.27.1])([2][answerCallbackQuery-v0.29.0])** that are being deprecated. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#answercallbackquery | Param | Type | Description | | --- | --- | --- | | callbackQueryId | String | Unique identifier for the query to be answered | | [options] | Object | Additional Telegram query options | ### telegramBot.editMessageText(text, [options]) ⇒ Promise Use this method to edit text messages sent by the bot or via the bot (for inline bots). On success, the edited Message is returned. Note that you must provide one of chat_id, message_id, or inline_message_id in your request. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#editmessagetext | Param | Type | Description | | --- | --- | --- | | text | String | New text of the message | | [options] | Object | Additional Telegram query options (provide either one of chat_id, message_id, or inline_message_id here) | ### telegramBot.editMessageCaption(caption, [options]) ⇒ Promise Use this method to edit captions of messages sent by the bot or via the bot (for inline bots). On success, the edited Message is returned. Note that you must provide one of chat_id, message_id, or inline_message_id in your request. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#editmessagecaption | Param | Type | Description | | --- | --- | --- | | caption | String | New caption of the message | | [options] | Object | Additional Telegram query options (provide either one of chat_id, message_id, or inline_message_id here) | ### telegramBot.editMessageMedia(media, [options]) ⇒ Promise Use this method to edit audio, document, photo, or video messages. If a message is a part of a message album, then it can be edited only to a photo or a video. Otherwise, message type can be changed arbitrarily. When inline message is edited, new file can't be uploaded. Use previously uploaded file via its file_id or specify a URL. On success, the edited Message is returned. Note that you must provide one of chat_id, message_id, or inline_message_id in your request. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#editmessagemedia | Param | Type | Description | | --- | --- | --- | | media | Object | A JSON-serialized object for a new media content of the message | | [options] | Object | Additional Telegram query options (provide either one of chat_id, message_id, or inline_message_id here) | ### telegramBot.editMessageReplyMarkup(replyMarkup, [options]) ⇒ Promise Use this method to edit only the reply markup of messages sent by the bot or via the bot (for inline bots). On success, the edited Message is returned. Note that you must provide one of chat_id, message_id, or inline_message_id in your request. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#editmessagetext | Param | Type | Description | | --- | --- | --- | | replyMarkup | Object | A JSON-serialized object for an inline keyboard. | | [options] | Object | Additional Telegram query options (provide either one of chat_id, message_id, or inline_message_id here) | ### telegramBot.getUserProfilePhotos(userId, [options]) ⇒ Promise Use this method to get a list of profile pictures for a user. Returns a [UserProfilePhotos](https://core.telegram.org/bots/api#userprofilephotos) object. This method has an [older, compatible signature][getUserProfilePhotos-v0.25.0] that is being deprecated. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#getuserprofilephotos | Param | Type | Description | | --- | --- | --- | | userId | Number | Unique identifier of the target user | | [options] | Object | Additional Telegram query options | ### telegramBot.sendLocation(chatId, latitude, longitude, [options]) ⇒ Promise Send location. Use this method to send point on the map. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#sendlocation | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | Unique identifier for the message recipient | | latitude | Float | Latitude of location | | longitude | Float | Longitude of location | | [options] | Object | Additional Telegram query options | ### telegramBot.editMessageLiveLocation(latitude, longitude, [options]) ⇒ Promise Use this method to edit live location messages sent by the bot or via the bot (for inline bots). Note that you must provide one of chat_id, message_id, or inline_message_id in your request. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#editmessagelivelocation | Param | Type | Description | | --- | --- | --- | | latitude | Float | Latitude of location | | longitude | Float | Longitude of location | | [options] | Object | Additional Telegram query options (provide either one of chat_id, message_id, or inline_message_id here) | ### telegramBot.stopMessageLiveLocation([options]) ⇒ Promise 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 [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#stopmessagelivelocation | Param | Type | Description | | --- | --- | --- | | [options] | Object | Additional Telegram query options (provide either one of chat_id, message_id, or inline_message_id here) | ### telegramBot.sendVenue(chatId, latitude, longitude, title, address, [options]) ⇒ Promise Send venue. Use this method to send information about a venue. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#sendvenue | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | Unique identifier for the message recipient | | latitude | Float | Latitude of location | | longitude | Float | Longitude of location | | title | String | Name of the venue | | address | String | Address of the venue | | [options] | Object | Additional Telegram query options | ### telegramBot.sendContact(chatId, phoneNumber, firstName, [options]) ⇒ Promise Send contact. Use this method to send phone contacts. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#sendcontact | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | Unique identifier for the message recipient | | phoneNumber | String | Contact's phone number | | firstName | String | Contact's first name | | [options] | Object | Additional Telegram query options | ### telegramBot.sendPoll(chatId, question, pollOptions, [options]) ⇒ Promise Send poll. Use this method to send a native poll. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#sendpoll | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | Unique identifier for the group/channel | | question | String | Poll question, 255 char limit | | pollOptions | Array | Poll options, between 2-10 options | | [options] | Object | Additional Telegram query options | ### telegramBot.stopPoll(chatId, pollId, [options]) ⇒ Promise Stop poll. Use this method to stop a native poll. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#stoppoll | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | Unique identifier for the group/channel | | pollId | Number | Identifier of the original message with the poll | | [options] | Object | Additional Telegram query options | ### telegramBot.getFile(fileId, [options]) ⇒ Promise Get file. Use this method to get basic info about a file and prepare it for downloading. Attention: link will be valid for 1 hour. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#getfile | Param | Type | Description | | --- | --- | --- | | fileId | String | File identifier to get info about | | [options] | Object | Additional Telegram query options | ### telegramBot.getFileLink(fileId, [options]) ⇒ Promise 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 [TelegramBot](#TelegramBot) **Returns**: Promise - promise Promise which will have *fileURI* in resolve callback **See**: https://core.telegram.org/bots/api#getfile | Param | Type | Description | | --- | --- | --- | | fileId | String | File identifier to get info about | | [options] | Object | Additional Telegram query options | ### telegramBot.getFileStream(fileId, [options]) ⇒ stream.Readable 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 [TelegramBot](#TelegramBot) **Returns**: stream.Readable - fileStream | Param | Type | Description | | --- | --- | --- | | fileId | String | File identifier to get info about | | [options] | Object | Additional Telegram query options | ### telegramBot.downloadFile(fileId, downloadDir, [options]) ⇒ Promise 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 [TelegramBot](#TelegramBot) **Returns**: Promise - promise Promise, which will have *filePath* of downloaded file in resolve callback | Param | Type | Description | | --- | --- | --- | | fileId | String | File identifier to get info about | | downloadDir | String | Absolute path to the folder in which file will be saved | | [options] | Object | Additional Telegram query options | ### telegramBot.onText(regexp, callback) Register a RegExp to test against an incomming text message. **Kind**: instance method of [TelegramBot](#TelegramBot) | Param | Type | Description | | --- | --- | --- | | regexp | RegExp | RegExp to be executed with `exec`. | | callback | function | Callback will be called with 2 parameters, the `msg` and the result of executing `regexp.exec` on message text. | ### telegramBot.removeTextListener(regexp) ⇒ Object Remove a listener registered with `onText()`. **Kind**: instance method of [TelegramBot](#TelegramBot) **Returns**: Object - deletedListener The removed reply listener if found. This object has `regexp` and `callback` properties. If not found, returns `null`. | Param | Type | Description | | --- | --- | --- | | regexp | RegExp | RegExp used previously in `onText()` | ### telegramBot.onReplyToMessage(chatId, messageId, callback) ⇒ Number Register a reply to wait for a message response. **Kind**: instance method of [TelegramBot](#TelegramBot) **Returns**: Number - id The ID of the inserted reply listener. | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | The chat id where the message cames from. | | messageId | Number \| String | The message id to be replied. | | callback | function | Callback will be called with the reply message. | ### telegramBot.removeReplyListener(replyListenerId) ⇒ Object Removes a reply that has been prev. registered for a message response. **Kind**: instance method of [TelegramBot](#TelegramBot) **Returns**: Object - 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 | Number | The ID of the reply listener. | ### telegramBot.getChat(chatId, [options]) ⇒ Promise Use this method to 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.). **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#getchat | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | Unique identifier for the target chat or username of the target supergroup or channel | | [options] | Object | Additional Telegram query options | ### telegramBot.getChatAdministrators(chatId, [options]) ⇒ Promise Returns the administrators in a chat in form of an Array of `ChatMember` objects. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#getchatadministrators | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | Unique identifier for the target group or username of the target supergroup | | [options] | Object | Additional Telegram query options | ### telegramBot.getChatMembersCount(chatId, [options]) ⇒ Promise Use this method to get the number of members in a chat. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#getchatmemberscount | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | Unique identifier for the target group or username of the target supergroup | | [options] | Object | Additional Telegram query options | ### telegramBot.getChatMember(chatId, userId, [options]) ⇒ Promise Use this method to get information about a member of a chat. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#getchatmember | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | Unique identifier for the target group or username of the target supergroup | | userId | Number | Unique identifier of the target user | | [options] | Object | Additional Telegram query options | ### telegramBot.leaveChat(chatId, [options]) ⇒ Promise Leave a group, supergroup or channel. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#leavechat | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername) | | [options] | Object | Additional Telegram query options | ### telegramBot.setChatStickerSet(chatId, stickerSetName, [options]) ⇒ Promise Use this method to set a new group sticker set for a supergroup. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#setchatstickerset | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername) | | stickerSetName | String | Name of the sticker set to be set as the group sticker set | | [options] | Object | Additional Telegram query options | ### telegramBot.deleteChatStickerSet(chatId, [options]) ⇒ Promise Use this method to delete a group sticker set from a supergroup. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#deletechatstickerset | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername) | | [options] | Object | Additional Telegram query options | ### telegramBot.sendGame(chatId, gameShortName, [options]) ⇒ Promise Use this method to send a game. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#sendgame | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | Unique identifier for the message recipient | | gameShortName | String | name of the game to be sent. | | [options] | Object | Additional Telegram query options | ### telegramBot.setGameScore(userId, score, [options]) ⇒ Promise Use this method to set the score of the specified user in a game. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#setgamescore | Param | Type | Description | | --- | --- | --- | | userId | Number | Unique identifier of the target user | | score | Number | New score value. | | [options] | Object | Additional Telegram query options | ### telegramBot.getGameHighScores(userId, [options]) ⇒ Promise Use this method to get data for high score table. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#getgamehighscores | Param | Type | Description | | --- | --- | --- | | userId | Number | Unique identifier of the target user | | [options] | Object | Additional Telegram query options | ### telegramBot.deleteMessage(chatId, messageId, [options]) ⇒ Promise Use this method to delete a message. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#deletemessage | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | Unique identifier of the target chat | | messageId | Number | Unique identifier of the target message | | [options] | Object | Additional Telegram query options | ### telegramBot.sendInvoice(chatId, title, description, payload, providerToken, startParameter, currency, prices, [options]) ⇒ Promise Send invoice. Use this method to send an invoice. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#sendinvoice | Param | Type | Description | | --- | --- | --- | | chatId | Number \| String | Unique identifier for the message recipient | | title | String | Product name | | description | String | product description | | payload | String | Bot defined invoice payload | | providerToken | String | Payments provider token | | startParameter | String | Deep-linking parameter | | currency | String | Three-letter ISO 4217 currency code | | prices | Array | Breakdown of prices | | [options] | Object | Additional Telegram query options | ### telegramBot.answerShippingQuery(shippingQueryId, ok, [options]) ⇒ Promise Answer shipping query.. Use this method to reply to shipping queries. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#answershippingquery | Param | Type | Description | | --- | --- | --- | | shippingQueryId | String | Unique identifier for the query to be answered | | ok | Boolean | Specify if delivery of the product is possible | | [options] | Object | Additional Telegram query options | ### telegramBot.answerPreCheckoutQuery(preCheckoutQueryId, ok, [options]) ⇒ Promise Answer pre-checkout query. Use this method to confirm shipping of a product. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#answerprecheckoutquery | Param | Type | Description | | --- | --- | --- | | preCheckoutQueryId | String | Unique identifier for the query to be answered | | ok | Boolean | Specify if every order details are ok | | [options] | Object | Additional Telegram query options | ### telegramBot.getStickerSet(name, [options]) ⇒ Promise Use this method to get a sticker set. On success, a [StickerSet](https://core.telegram.org/bots/api#stickerset) object is returned. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#getstickerset | Param | Type | Description | | --- | --- | --- | | name | String | Name of the sticker set | | [options] | Object | Additional Telegram query options | ### telegramBot.uploadStickerFile(userId, pngSticker, [options], [fileOptions]) ⇒ Promise Use this method to upload a .png file with a sticker for later use in *createNewStickerSet* and *addStickerToSet* methods (can be used multiple times). Returns the uploaded [File](https://core.telegram.org/bots/api#file) on success. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#uploadstickerfile | Param | Type | Description | | --- | --- | --- | | userId | Number | User identifier of sticker file owner | | pngSticker | String \| stream.Stream \| Buffer | A file path or a Stream. Can also be a `file_id` previously uploaded. **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. | | [options] | Object | Additional Telegram query options | | [fileOptions] | Object | Optional file related meta-data | ### telegramBot.createNewStickerSet(userId, name, title, pngSticker, emojis, [options], [fileOptions]) ⇒ Promise Use this method to create new sticker set owned by a user. The bot will be able to edit the created sticker set. Returns True on success. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#createnewstickerset **Todo** - [ ] Add tests for this method! | Param | Type | Description | | --- | --- | --- | | userId | Number | User identifier of created sticker set owner | | name | String | Short name of sticker set, to be used in `t.me/addstickers/` URLs (e.g., *animals*) | | title | String | Sticker set title, 1-64 characters | | pngSticker | String \| stream.Stream \| Buffer | 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. | | emojis | String | One or more emoji corresponding to the sticker | | [options] | Object | Additional Telegram query options | | [fileOptions] | Object | Optional file related meta-data | ### telegramBot.addStickerToSet(userId, name, pngSticker, emojis, [options], [fileOptions]) ⇒ Promise Use this method to add a new sticker to a set created by the bot. Returns True on success. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#addstickertoset **Todo** - [ ] Add tests for this method! | Param | Type | Description | | --- | --- | --- | | userId | Number | User identifier of sticker set owner | | name | String | Sticker set name | | pngSticker | String \| stream.Stream \| Buffer | 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 | | emojis | String | One or more emoji corresponding to the sticker | | [options] | Object | Additional Telegram query options | | [fileOptions] | Object | Optional file related meta-data | ### telegramBot.setStickerPositionInSet(sticker, position, [options]) ⇒ Promise Use this method to move a sticker in a set created by the bot to a specific position. Returns True on success. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#setstickerpositioninset **Todo** - [ ] Add tests for this method! | Param | Type | Description | | --- | --- | --- | | sticker | String | File identifier of the sticker | | position | Number | New sticker position in the set, zero-based | | [options] | Object | Additional Telegram query options | ### telegramBot.deleteStickerFromSet(sticker, [options]) ⇒ Promise Use this method to delete a sticker from a set created by the bot. Returns True on success. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#deletestickerfromset **Todo** - [ ] Add tests for this method! | Param | Type | Description | | --- | --- | --- | | sticker | String | File identifier of the sticker | | [options] | Object | Additional Telegram query options | ### telegramBot.sendMediaGroup(chatId, media, [options]) ⇒ Promise Use this method to send a group of photos or videos as an album. On success, an array of the sent [Messages](https://core.telegram.org/bots/api#message) is returned. 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 [TelegramBot](#TelegramBot) **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 | String | Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) | | media | Array | A JSON-serialized array describing photos and videos to be sent, must include 2–10 items | | [options] | Object | Additional Telegram query options | ### TelegramBot.errors : Object The different errors the library uses. **Kind**: static property of [TelegramBot](#TelegramBot) ### TelegramBot.messageTypes : Array.<String> The types of message updates the library handles. **Kind**: static property of [TelegramBot](#TelegramBot) ### TelegramBot.Promise Change Promise library used internally, for all existing and new instances. **Kind**: static property of [TelegramBot](#TelegramBot) | Param | Type | | --- | --- | | customPromise | function | **Example** ```js const TelegramBot = require('node-telegram-bot-api'); TelegramBot.Promise = myPromise; ``` * * * [usage-sending-files-performance]:https://github.com/yagop/node-telegram-bot-api/tree/master/doc/usage.md#sending-files-performance [setWebHook-v0.25.0]:https://github.com/yagop/node-telegram-bot-api/tree/4e5a493cadfaad5589a8d79e55d9e0d103000ce4#telegrambotsetwebhookurl-cert [getUpdates-v0.25.0]:https://github.com/yagop/node-telegram-bot-api/tree/4e5a493cadfaad5589a8d79e55d9e0d103000ce4#TelegramBot+getUpdates [getUserProfilePhotos-v0.25.0]:https://github.com/yagop/node-telegram-bot-api/tree/4e5a493cadfaad5589a8d79e55d9e0d103000ce4#TelegramBot+getUserProfilePhotos [answerCallbackQuery-v0.27.1]:https://github.com/yagop/node-telegram-bot-api/blob/v0.27.1/doc/api.md#TelegramBot+answerCallbackQuery [answerCallbackQuery-v0.29.0]:https://github.com/yagop/node-telegram-bot-api/blob/v0.29.0/doc/api.md#TelegramBot+answerCallbackQuery