diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bb5a2c..f659140 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,28 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). -## [0.52.1][0.52.1] - 2021-04-26 + +## [0.54.0][0.54.0] - 2021-06-29 + +Added: + +1. Support Bot API v5.3: (@danielperez9430) + + * Add method *deleteMyCommands()* + * Add method *banChatMember()* + * Add method *getChatMemberCount()* + + New Test: + + * deleteMyCommands + * banChatMember + * getChatMemberCount + + Deprecated: + * Method *kickChatMember()* + * Method *getChatMembersCount()* + +## [0.53.0][0.53.0] - 2021-04-26 Added: diff --git a/doc/api.md b/doc/api.md index 81fa3e9..fb78579 100644 --- a/doc/api.md +++ b/doc/api.md @@ -1,7 +1,7 @@ -# API Reference - -**Note:** If you are looking for available [events](usage.md#events) or usage of api, please refer [`usage.md`](usage.md). - +# API Reference + +**Note:** If you are looking for available [events](usage.md#events) or usage of api, please refer [`usage.md`](usage.md). + ## TelegramBot @@ -43,7 +43,8 @@ TelegramBot * [.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 + * ~~[.kickChatMember(chatId, userId, [options])](#TelegramBot+kickChatMember) ⇒ Promise~~ + * [.banChatMember(chatId, userId, [options])](#TelegramBot+banChatMember) ⇒ Promise * [.unbanChatMember(chatId, userId, [options])](#TelegramBot+unbanChatMember) ⇒ Promise * [.restrictChatMember(chatId, userId, [options])](#TelegramBot+restrictChatMember) ⇒ Promise * [.promoteChatMember(chatId, userId, [options])](#TelegramBot+promoteChatMember) ⇒ Promise @@ -63,6 +64,7 @@ TelegramBot * [.answerCallbackQuery(callbackQueryId, [options])](#TelegramBot+answerCallbackQuery) ⇒ Promise * [.setMyCommands(commands, [options])](#TelegramBot+setMyCommands) ⇒ Promise * [.getMyCommands([options])](#TelegramBot+getMyCommands) ⇒ Promise + * [.deleteMyCommands([options])](#TelegramBot+deleteMyCommands) ⇒ Promise * [.editMessageText(text, [options])](#TelegramBot+editMessageText) ⇒ Promise * [.editMessageCaption(caption, [options])](#TelegramBot+editMessageCaption) ⇒ Promise * [.editMessageMedia(media, [options])](#TelegramBot+editMessageMedia) ⇒ Promise @@ -87,7 +89,8 @@ TelegramBot * [.clearReplyListeners()](#TelegramBot+clearReplyListeners) * [.getChat(chatId, [options])](#TelegramBot+getChat) ⇒ Promise * [.getChatAdministrators(chatId, [options])](#TelegramBot+getChatAdministrators) ⇒ Promise - * [.getChatMembersCount(chatId, [options])](#TelegramBot+getChatMembersCount) ⇒ Promise + * ~~[.getChatMembersCount(chatId, [options])](#TelegramBot+getChatMembersCount) ⇒ Promise~~ + * [.getChatMemberCount(chatId, [options])](#TelegramBot+getChatMemberCount) ⇒ Promise * [.getChatMember(chatId, userId, [options])](#TelegramBot+getChatMember) ⇒ Promise * [.leaveChat(chatId, [options])](#TelegramBot+leaveChat) ⇒ Promise * [.setChatStickerSet(chatId, stickerSetName, [options])](#TelegramBot+setChatStickerSet) ⇒ Promise @@ -114,7 +117,9 @@ TelegramBot ### 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. +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 | @@ -145,7 +150,8 @@ Both request method to obtain messages are implemented. To use standard polling, ### 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. +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** @@ -162,7 +168,8 @@ Add listener for the specified [event](https://github.com/yagop/node-telegram-bo ### telegramBot.startPolling([options]) ⇒ Promise -Start polling. Rejects returned promise if a WebHook is being used by this instance. +Start polling. +Rejects returned promise if a WebHook is being used by this instance. **Kind**: instance method of [TelegramBot](#TelegramBot) @@ -187,7 +194,9 @@ Alias of `TelegramBot#startPolling()`. This is **deprecated**. ### 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**. +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) @@ -206,20 +215,24 @@ Return true if polling. Otherwise, false. ### 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. +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. +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. +Return true if using webhook and it is open i.e. accepts connections. +Otherwise, false. **Kind**: instance method of [TelegramBot](#TelegramBot) @@ -237,7 +250,10 @@ Returns basic information about the bot in form of a `User` object. ### telegramBot.logOut([options]) ⇒ Promise -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. Returns True on success. +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. +Returns True on success. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#logout @@ -249,7 +265,9 @@ This method log out your bot from the cloud Bot API server before launching the ### telegramBot.close([options]) ⇒ Promise -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. Returns True on success. +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. +Returns True on success. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#close @@ -261,7 +279,9 @@ This method close the bot instance before moving it from one local server to ano ### 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. +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** @@ -280,7 +300,8 @@ Specify an url to receive incoming updates via an outgoing webHook. This method ### telegramBot.deleteWebHook([options]) ⇒ Promise -Use this method to remove webhook integration if you decide to switch back to getUpdates. Returns True on success. +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 @@ -292,7 +313,10 @@ Use this method to remove webhook integration if you decide to switch back to ge ### 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. +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 @@ -304,7 +328,9 @@ Use this method to get current webhook status. On success, returns a [WebhookInf ### 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. +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 @@ -316,7 +342,9 @@ Use this method to receive incoming updates using long polling. This method has ### 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. +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 @@ -371,7 +399,10 @@ Forward messages of any kind. ### telegramBot.copyMessage(chatId, fromChatId, messageId, [options]) ⇒ Promise -Copy messages of any kind. 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. +Copy messages of any kind. +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 [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#copymessage @@ -424,7 +455,8 @@ Send audio ### telegramBot.sendDice(chatId, [options]) ⇒ Promise -Send Dice Use this method to send a dice. +Send Dice +Use this method to send a dice. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#senddice @@ -548,7 +580,11 @@ Send voice ### 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. +Send chat action. +`typing` for text messages, +`upload_photo` for photos, `record_video` or `upload_video` for videos, +`record_voice` or `upload_voice` 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 @@ -561,8 +597,14 @@ Send chat action. `typing` for text messages, `upload_photo` for photos, `record -### 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. +### ~~telegramBot.kickChatMember(chatId, userId, [options]) ⇒ Promise~~ +***Deprecated*** + +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 @@ -573,10 +615,31 @@ Use this method to kick a user from a group or a supergroup. In the case of supe | userId | Number | Unique identifier of the target user | | [options] | Object | Additional Telegram query options | + + +### telegramBot.banChatMember(chatId, userId, [options]) ⇒ Promise +Use this method to ban a user in a group, a supergroup or a channel. +In the case of supergroups and channels, the user will not be able to +return to the chat 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#banchatmember + +| 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. +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 @@ -590,7 +653,10 @@ Use this method to unban a previously kicked user in a supergroup. The user will ### 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. +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 @@ -604,7 +670,10 @@ Use this method to restrict a user in a supergroup. The bot must be an administr ### 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. +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 @@ -618,7 +687,8 @@ Use this method to promote or demote a user in a supergroup or a channel. The bo ### telegramBot.setChatAdministratorCustomTitle(chatId, userId, customTitle, [options]) ⇒ Promise -Use this method to set a custom title for an administrator in a supergroup promoted by the bot. Returns True on success. +Use this method to set a custom title for an administrator in a supergroup promoted by the bot. +Returns True on success. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#setchatadministratorcustomtitle @@ -633,7 +703,10 @@ Use this method to set a custom title for an administrator in a supergroup promo ### telegramBot.setChatPermissions(chatId, chatPermissions, [options]) ⇒ Promise -Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members admin rights. Returns True on success. +Use this method to set default chat permissions for all members. +The bot must be an administrator in the group or a supergroup for this to +work and must have the can_restrict_members admin rights. +Returns True on success. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#setchatpermissions @@ -647,7 +720,9 @@ Use this method to set default chat permissions for all members. The bot must be ### 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. +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 @@ -660,7 +735,9 @@ Use this method to export an invite link to a supergroup or a channel. The bot m ### telegramBot.createChatInviteLink(chatId, [options]) ⇒ Object -Use this method to create an additional invite link for a chat. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns the new invite link as ChatInviteLink object. +Use this method to create an additional invite link for a chat. +The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. +Returns the new invite link as ChatInviteLink object. **Kind**: instance method of [TelegramBot](#TelegramBot) **Returns**: Object - ChatInviteLink @@ -674,7 +751,9 @@ Use this method to create an additional invite link for a chat. The bot must be ### telegramBot.editChatInviteLink(chatId, inviteLink, [options]) ⇒ Object -Use this method to edit a non-primary invite link created by the bot. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns the edited invite link as a ChatInviteLink object. +Use this method to edit a non-primary invite link created by the bot. +The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. +Returns the edited invite link as a ChatInviteLink object. **Kind**: instance method of [TelegramBot](#TelegramBot) **Returns**: Object - ChatInviteLink @@ -689,7 +768,10 @@ Use this method to edit a non-primary invite link created by the bot. The bot mu ### telegramBot.revokeChatInviteLink(chatId, [options]) ⇒ Object -Use this method to revoke an invite link created by the bot. Note: If the primary link is revoked, a new link is automatically generated The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns the revoked invite link as ChatInviteLink object. +Use this method to revoke an invite link created by the bot. +Note: If the primary link is revoked, a new link is automatically generated +The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. +Returns the revoked invite link as ChatInviteLink object. **Kind**: instance method of [TelegramBot](#TelegramBot) **Returns**: Object - ChatInviteLink @@ -703,7 +785,9 @@ Use this method to revoke an invite link created by the bot. Note: If the primar ### 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. +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 @@ -718,7 +802,9 @@ Use this method to set a new profile photo for the chat. Photos can't be changed ### 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. +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 @@ -731,7 +817,9 @@ Use this method to delete a chat photo. Photos can't be changed for private chat ### 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. +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 @@ -745,7 +833,9 @@ Use this method to change the title of a chat. Titles can't be changed for priva ### 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. +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 @@ -759,7 +849,9 @@ Use this method to change the description of a supergroup or a channel. The bot ### 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. +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 @@ -773,7 +865,9 @@ Use this method to pin a message in a supergroup. The bot must be an administrat ### 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. +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 @@ -786,7 +880,9 @@ Use this method to unpin a message in a supergroup chat. The bot must be an admi ### telegramBot.unpinAllChatMessages(chatId, [options]) ⇒ Promise -Use this method to clear the list of pinned messages in a 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. +Use this method to clear the list of pinned messages in a 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#unpinallchatmessages @@ -799,7 +895,13 @@ Use this method to clear the list of pinned messages in a chat The bot must be a ### 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. +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 @@ -812,7 +914,8 @@ Use this method to send answers to callback queries sent from inline keyboards. ### telegramBot.setMyCommands(commands, [options]) ⇒ Promise -Returns True on success. Use this method to change the list of the bot's commands. +Returns True on success. +Use this method to change the list of the bot's commands. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#setmycommands @@ -834,10 +937,28 @@ Returns Array of BotCommand on success. | --- | --- | --- | | [options] | Object | Additional Telegram query options | + + +### telegramBot.deleteMyCommands([options]) ⇒ Promise +Returns True on success. +Use this method to delete the list of the bot's commands for the given scope and user language. + +**Kind**: instance method of [TelegramBot](#TelegramBot) +**See**: https://core.telegram.org/bots/api#deletemycommands + +| Param | Type | Description | +| --- | --- | --- | +| [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. +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 @@ -850,7 +971,12 @@ Use this method to edit text messages sent by the bot or via the bot (for inline ### 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. +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 @@ -863,7 +989,14 @@ Use this method to edit captions of messages sent by the bot or via the bot (for ### 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. +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 @@ -876,7 +1009,12 @@ Use this method to edit audio, document, photo, or video messages. If a message ### 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. +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 @@ -889,7 +1027,10 @@ Use this method to edit only the reply markup of messages sent by the bot or via ### 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. +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 @@ -902,7 +1043,8 @@ Use this method to get a list of profile pictures for a user. Returns a [UserPro ### telegramBot.sendLocation(chatId, latitude, longitude, [options]) ⇒ Promise -Send location. Use this method to send point on the map. +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 @@ -917,7 +1059,11 @@ Send location. Use this method to send point on the map. ### 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. +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 @@ -931,7 +1077,11 @@ Use this method to edit live location messages sent by the bot or via the bot (f ### 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. +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 @@ -943,7 +1093,8 @@ Use this method to stop updating a live location message sent by the bot or via ### telegramBot.sendVenue(chatId, latitude, longitude, title, address, [options]) ⇒ Promise -Send venue. Use this method to send information about a venue. +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 @@ -960,7 +1111,8 @@ Send venue. Use this method to send information about a venue. ### telegramBot.sendContact(chatId, phoneNumber, firstName, [options]) ⇒ Promise -Send contact. Use this method to send phone contacts. +Send contact. +Use this method to send phone contacts. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#sendcontact @@ -975,7 +1127,8 @@ Send contact. Use this method to send phone contacts. ### telegramBot.sendPoll(chatId, question, pollOptions, [options]) ⇒ Promise -Send poll. Use this method to send a native poll. +Send poll. +Use this method to send a native poll. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#sendpoll @@ -990,7 +1143,8 @@ Send poll. Use this method to send a native poll. ### telegramBot.stopPoll(chatId, pollId, [options]) ⇒ Promise -Stop poll. Use this method to stop a native poll. +Stop poll. +Use this method to stop a native poll. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#stoppoll @@ -1004,7 +1158,9 @@ Stop poll. Use this method to stop a native poll. ### 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. +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 @@ -1017,7 +1173,12 @@ Get file. Use this method to get basic info about a file and prepare it for down ### 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). +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 @@ -1031,7 +1192,15 @@ Get link for file. Use this method to get link for file for subsequent use. Atte ### 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. +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 @@ -1044,7 +1213,10 @@ Return a readable stream for file. `fileStream.path` is the specified file ID i ### 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. +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 @@ -1073,7 +1245,9 @@ Register a RegExp to test against an incomming text message. 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`. +**Returns**: Object - deletedListener The removed reply listener if + found. This object has `regexp` and `callback` + properties. If not found, returns `null`. | Param | Type | Description | | --- | --- | --- | @@ -1105,7 +1279,9 @@ Register a reply to wait for a message response. 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`. +**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 | | --- | --- | --- | @@ -1120,7 +1296,9 @@ Removes all replies that have been prev. registered for a message response. ### 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.). +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 @@ -1145,8 +1323,11 @@ Returns the administrators in a chat in form of an Array of `ChatMember` objects -### telegramBot.getChatMembersCount(chatId, [options]) ⇒ Promise +### ~~telegramBot.getChatMembersCount(chatId, [options]) ⇒ Promise~~ +***Deprecated*** + Use this method to get the number of members in a chat. +Returns Int on success. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#getchatmemberscount @@ -1156,6 +1337,20 @@ Use this method to get the number of members in a chat. | chatId | Number \| String | Unique identifier for the target group or username of the target supergroup | | [options] | Object | Additional Telegram query options | + + +### telegramBot.getChatMemberCount(chatId, [options]) ⇒ Promise +Use this method to get the number of members in a chat. +Returns Int on success + +**Kind**: instance method of [TelegramBot](#TelegramBot) +**See**: https://core.telegram.org/bots/api#getchatmembercount + +| 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 @@ -1268,7 +1463,8 @@ Use this method to delete a message. ### telegramBot.sendInvoice(chatId, title, description, payload, providerToken, startParameter, currency, prices, [options]) ⇒ Promise -Send invoice. Use this method to send an invoice. +Send invoice. +Use this method to send an invoice. **Kind**: instance method of [TelegramBot](#TelegramBot) **See**: https://core.telegram.org/bots/api#sendinvoice @@ -1288,7 +1484,8 @@ Send invoice. Use this method to send an invoice. ### telegramBot.answerShippingQuery(shippingQueryId, ok, [options]) ⇒ Promise -Answer shipping query.. Use this method to reply to shipping queries. +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 @@ -1302,7 +1499,8 @@ Answer shipping query.. Use this method to reply to shipping queries. ### telegramBot.answerPreCheckoutQuery(preCheckoutQueryId, ok, [options]) ⇒ Promise -Answer pre-checkout query. Use this method to confirm shipping of a product. +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 @@ -1329,7 +1527,8 @@ Use this method to get a sticker set. On success, a [StickerSet](https://core.te ### 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. +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 @@ -1344,7 +1543,9 @@ Use this method to upload a .png file with a sticker for later use in *createNew ### 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. +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 @@ -1366,7 +1567,8 @@ Use this method to create new sticker set owned by a user. The bot will be able ### 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. +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 @@ -1387,7 +1589,8 @@ Use this method to add a new sticker to a set created by the bot. Returns True o ### 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. +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 @@ -1405,7 +1608,8 @@ Use this method to move a sticker in a set created by the bot to a specific posi ### telegramBot.deleteStickerFromSet(sticker, [options]) ⇒ Promise -Use this method to delete a sticker from a set created by the bot. Returns True on success. +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 @@ -1422,7 +1626,12 @@ Use this method to delete a sticker from a set created by the bot. Returns True ### 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`. +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** @@ -1452,7 +1661,8 @@ The types of message updates the library handles. ### TelegramBot.Promise -Change Promise library used internally, for all existing and new instances. +Change Promise library used internally, for all existing and new +instances. **Kind**: static property of [TelegramBot](#TelegramBot) @@ -1462,14 +1672,15 @@ Change Promise library used internally, for all existing and new instances. **Example** ```js -const TelegramBot = require('node-telegram-bot-api'); TelegramBot.Promise = myPromise; +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 +* * * + + +[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 diff --git a/src/telegram.js b/src/telegram.js index f91c9a1..15eb07b 100644 --- a/src/telegram.js +++ b/src/telegram.js @@ -1043,13 +1043,34 @@ class TelegramBot extends EventEmitter { * @param {Object} [options] Additional Telegram query options * @return {Promise} * @see https://core.telegram.org/bots/api#kickchatmember + * @deprecated Deprecated since Telegram Bot API v5.3, replace with "banChatMember" */ kickChatMember(chatId, userId, form = {}) { + deprecate('The method kickChatMembet is deprecated since Telegram Bot API v5.3, replace it with "banChatMember"'); form.chat_id = chatId; form.user_id = userId; return this._request('kickChatMember', { form }); } + /** + * Use this method to ban a user in a group, a supergroup or a channel. + * In the case of supergroups and channels, the user will not be able to + * return to the chat 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. + * + * @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup + * @param {Number} userId Unique identifier of the target user + * @param {Object} [options] Additional Telegram query options + * @return {Promise} + * @see https://core.telegram.org/bots/api#banchatmember + */ + banChatMember(chatId, userId, form = {}) { + form.chat_id = chatId; + form.user_id = userId; + return this._request('banChatMember', { form }); + } + /** * Use this method to unban a previously kicked user in a supergroup. * The user will not return to the group automatically, but will be @@ -1393,6 +1414,17 @@ class TelegramBot extends EventEmitter { return this._request('getMyCommands', { form }); } + /** + * Returns True on success. + * Use this method to delete the list of the bot's commands for the given scope and user language. + * @param {Object} [options] Additional Telegram query options + * @return {Promise} + * @see https://core.telegram.org/bots/api#deletemycommands + */ + deleteMyCommands(form = {}) { + return this._request('deleteMyCommands', { form }); + } + /** * Use this method to edit text messages sent by the bot or via * the bot (for inline bots). On success, the edited Message is @@ -1824,16 +1856,33 @@ class TelegramBot extends EventEmitter { /** * Use this method to get the number of members in a chat. + * Returns Int on success. * @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup * @param {Object} [options] Additional Telegram query options * @return {Promise} * @see https://core.telegram.org/bots/api#getchatmemberscount + * @deprecated Deprecated since Telegram Bot API v5.3, replace it with "getChatMembersCount" */ getChatMembersCount(chatId, form = {}) { + deprecate('The method "getChatMembersCount" is deprecated since Telegram Bot API v5.3, replace it with "getChatMemberCount"'); + form.chat_id = chatId; return this._request('getChatMembersCount', { form }); } + /** + * Use this method to get the number of members in a chat. + * Returns Int on success + * @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup + * @param {Object} [options] Additional Telegram query options + * @return {Promise} + * @see https://core.telegram.org/bots/api#getchatmembercount + */ + getChatMemberCount(chatId, form = {}) { + form.chat_id = chatId; + return this._request('getChatMemberCount', { form }); + } + /** * Use this method to get information about a member of a chat. * @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup diff --git a/test/telegram.js b/test/telegram.js index 688eeea..95df8ef 100644 --- a/test/telegram.js +++ b/test/telegram.js @@ -834,7 +834,7 @@ describe('TelegramBot', function telegramSuite() { }); }); - describe.skip('#kickChatMember', function kickChatMemberSuite() { }); + describe.skip('#banChatMember', function banChatMemberSuite() { }); describe.skip('#unbanChatMember', function unbanChatMemberSuite() { }); @@ -864,6 +864,14 @@ describe('TelegramBot', function telegramSuite() { }); }); + describe('#deleteMyCommands', function deleteMyCommandsSuite() { + it('should delete bot commands', function test() { + return bot.deleteMyCommands().then(resp => { + assert.ok(is.boolean(resp)); + }); + }); + }); + describe.skip('#setChatAdministratorCustomTitle ', function setChatAdministratorCustomTitleSuite() { it('should set chat permissions', function test() { return bot.setChatAdministratorCustomTitle(GROUPID, USERID, 'Custom Name').then(resp => { @@ -1418,12 +1426,12 @@ describe('TelegramBot', function telegramSuite() { }); }); - describe('#getChatMembersCount', function getChatMembersCountSuite() { + describe('#getChatMemberCount', function getChatMemberCountSuite() { before(function before() { - utils.handleRatelimit(bot, 'getChatMembersCount', this); + utils.handleRatelimit(bot, 'getChatMemberCount', this); }); it('should return an Integer', function test() { - return bot.getChatMembersCount(GROUPID).then(resp => { + return bot.getChatMemberCount(GROUPID).then(resp => { assert.ok(Number.isInteger(resp)); }); });