mirror of
https://github.com/yagop/node-telegram-bot-api
synced 2025-08-29 05:17:41 +00:00
Closes #186: Add TelegramBot#leaveChat() method
This commit is contained in:
commit
ce4decebd8
13
README.md
13
README.md
@ -91,6 +91,7 @@ TelegramBot
|
|||||||
* [.getChatAdministrators(chatId)](#TelegramBot+getChatAdministrators) ⇒ <code>Promise</code>
|
* [.getChatAdministrators(chatId)](#TelegramBot+getChatAdministrators) ⇒ <code>Promise</code>
|
||||||
* [.getChatMembersCount(chatId)](#TelegramBot+getChatMembersCount) ⇒ <code>Promise</code>
|
* [.getChatMembersCount(chatId)](#TelegramBot+getChatMembersCount) ⇒ <code>Promise</code>
|
||||||
* [.getChatMember(chatId, userId)](#TelegramBot+getChatMember) ⇒ <code>Promise</code>
|
* [.getChatMember(chatId, userId)](#TelegramBot+getChatMember) ⇒ <code>Promise</code>
|
||||||
|
* [.leaveChat(chatId)](#TelegramBot+leaveChat) ⇒ <code>Promise</code>
|
||||||
|
|
||||||
<a name="new_TelegramBot_new"></a>
|
<a name="new_TelegramBot_new"></a>
|
||||||
|
|
||||||
@ -572,4 +573,16 @@ Use this method to get information about a member of a chat.
|
|||||||
| chatId | <code>Number</code> | <code>String</code> | Unique identifier for the target group or username of the target supergroup |
|
| chatId | <code>Number</code> | <code>String</code> | Unique identifier for the target group or username of the target supergroup |
|
||||||
| userId | <code>String</code> | Unique identifier of the target user |
|
| userId | <code>String</code> | Unique identifier of the target user |
|
||||||
|
|
||||||
|
<a name="TelegramBot+leaveChat"></a>
|
||||||
|
|
||||||
|
### telegramBot.leaveChat(chatId) ⇒ <code>Promise</code>
|
||||||
|
Leave a group, supergroup or channel.
|
||||||
|
|
||||||
|
**Kind**: instance method of <code>[TelegramBot](#TelegramBot)</code>
|
||||||
|
**See**: https://core.telegram.org/bots/api#leavechat
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| chatId | <code>Number</code> | <code>String</code> | Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername) |
|
||||||
|
|
||||||
* * *
|
* * *
|
||||||
|
@ -796,6 +796,19 @@ class TelegramBot extends EventEmitter {
|
|||||||
};
|
};
|
||||||
return this._request('getChatMember', { form });
|
return this._request('getChatMember', { form });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Leave a group, supergroup or channel.
|
||||||
|
* @param {Number|String} chatId Unique identifier for the target group or username of the target supergroup (in the format @supergroupusername)
|
||||||
|
* @return {Promise}
|
||||||
|
* @see https://core.telegram.org/bots/api#leavechat
|
||||||
|
*/
|
||||||
|
leaveChat(chatId) {
|
||||||
|
const form = {
|
||||||
|
chat_id: chatId
|
||||||
|
};
|
||||||
|
return this._request('leaveChat', { form });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = TelegramBot;
|
module.exports = TelegramBot;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user