From 394f3634651f7fca435720e4053b47b5c6f271b0 Mon Sep 17 00:00:00 2001 From: GochoMugo Date: Tue, 6 Sep 2016 17:14:13 +0300 Subject: [PATCH] Implement 'leaveChat' Notes: Merge branch 'feature/leaveChat' of https://github.com/GochoMugo/node-telegram-bot-api into pr/186 References: * PR #186: https://github.com/yagop/node-telegram-bot-api/pull/186 --- src/telegram.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/telegram.js b/src/telegram.js index efcc0c1..1119688 100644 --- a/src/telegram.js +++ b/src/telegram.js @@ -796,6 +796,19 @@ class TelegramBot extends EventEmitter { }; 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;