From f50936fd7b678aa8f14be55a4fa33765ed714452 Mon Sep 17 00:00:00 2001 From: Alex Godko Date: Thu, 30 Jun 2016 12:18:27 +0300 Subject: [PATCH 1/4] Update README.md Added a word about "callback_query" update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a3a25ba..4429932 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ There are some other examples on [examples](https://github.com/yagop/node-telegr ### Events Every time TelegramBot receives a message, it emits a `message`. Depending on which [message](https://core.telegram.org/bots/api#message) was received, emits an event from this ones: `text`, `audio`, `document`, `photo`, `sticker`, `video`, `voice`, `contact`, `location`, `new_chat_participant`, `left_chat_participant`, `new_chat_title`, `new_chat_photo`, `delete_chat_photo`, `group_chat_created`. Its much better to listen a specific event rather than a `message` in order to stay safe from the content. -TelegramBot emits `inline_query` when receives an [Inline Query](https://core.telegram.org/bots/api#inlinequery) and `chosen_inline_result` when receives a [ChosenInlineResult](https://core.telegram.org/bots/api#choseninlineresult). Bot must be enabled on [inline mode](https://core.telegram.org/bots/api#inline-mode) +TelegramBot emits `inline_query` when receives an [Inline Query](https://core.telegram.org/bots/api#inlinequery) and `chosen_inline_result` when receives a [ChosenInlineResult](https://core.telegram.org/bots/api#choseninlineresult). Also, `callback_query` event fires when a `callback_query` update received from Telegram (https://core.telegram.org/bots/api#update). Bot must be enabled on [inline mode](https://core.telegram.org/bots/api#inline-mode) * * * ### WebHooks From dcc3d481e4ac5dddbacf915cf78e5ec56dd54e9a Mon Sep 17 00:00:00 2001 From: GochoMugo Date: Mon, 10 Oct 2016 14:30:54 +0300 Subject: [PATCH 2/4] Add accompanying minor fixes and doc updates for PR #163 --- README.hbs | 1 + README.md | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.hbs b/README.hbs index eea8e82..f385066 100644 --- a/README.hbs +++ b/README.hbs @@ -33,6 +33,7 @@ There are some other examples on [examples](https://github.com/yagop/node-telegr ### Events Every time TelegramBot receives a message, it emits a `message`. Depending on which [message](https://core.telegram.org/bots/api#message) was received, emits an event from this ones: `text`, `audio`, `document`, `photo`, `sticker`, `video`, `voice`, `contact`, `location`, `new_chat_participant`, `left_chat_participant`, `new_chat_title`, `new_chat_photo`, `delete_chat_photo`, `group_chat_created`. Its much better to listen a specific event rather than a `message` in order to stay safe from the content. +TelegramBot emits `callback_query` when receives a [Callback Query](https://core.telegram.org/bots/api#callbackquery). TelegramBot emits `inline_query` when receives an [Inline Query](https://core.telegram.org/bots/api#inlinequery) and `chosen_inline_result` when receives a [ChosenInlineResult](https://core.telegram.org/bots/api#choseninlineresult). Bot must be enabled on [inline mode](https://core.telegram.org/bots/api#inline-mode) * * * diff --git a/README.md b/README.md index 4429932..b4439df 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,8 @@ There are some other examples on [examples](https://github.com/yagop/node-telegr ### Events Every time TelegramBot receives a message, it emits a `message`. Depending on which [message](https://core.telegram.org/bots/api#message) was received, emits an event from this ones: `text`, `audio`, `document`, `photo`, `sticker`, `video`, `voice`, `contact`, `location`, `new_chat_participant`, `left_chat_participant`, `new_chat_title`, `new_chat_photo`, `delete_chat_photo`, `group_chat_created`. Its much better to listen a specific event rather than a `message` in order to stay safe from the content. -TelegramBot emits `inline_query` when receives an [Inline Query](https://core.telegram.org/bots/api#inlinequery) and `chosen_inline_result` when receives a [ChosenInlineResult](https://core.telegram.org/bots/api#choseninlineresult). Also, `callback_query` event fires when a `callback_query` update received from Telegram (https://core.telegram.org/bots/api#update). Bot must be enabled on [inline mode](https://core.telegram.org/bots/api#inline-mode) +TelegramBot emits `callback_query` when receives a [Callback Query](https://core.telegram.org/bots/api#callbackquery). +TelegramBot emits `inline_query` when receives an [Inline Query](https://core.telegram.org/bots/api#inlinequery) and `chosen_inline_result` when receives a [ChosenInlineResult](https://core.telegram.org/bots/api#choseninlineresult). Bot must be enabled on [inline mode](https://core.telegram.org/bots/api#inline-mode) * * * ### WebHooks From 394f3634651f7fca435720e4053b47b5c6f271b0 Mon Sep 17 00:00:00 2001 From: GochoMugo Date: Tue, 6 Sep 2016 17:14:13 +0300 Subject: [PATCH 3/4] 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; From 5a11cce18d071414267e0169f190356084a73232 Mon Sep 17 00:00:00 2001 From: GochoMugo Date: Mon, 10 Oct 2016 14:47:52 +0300 Subject: [PATCH 4/4] Accompanying doc-updates for PR #186 --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index b4439df..326f504 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,7 @@ TelegramBot * [.getChatAdministrators(chatId)](#TelegramBot+getChatAdministrators) ⇒ Promise * [.getChatMembersCount(chatId)](#TelegramBot+getChatMembersCount) ⇒ Promise * [.getChatMember(chatId, userId)](#TelegramBot+getChatMember) ⇒ Promise + * [.leaveChat(chatId)](#TelegramBot+leaveChat) ⇒ Promise @@ -572,4 +573,16 @@ Use this method to get information about a member of a chat. | chatId | Number | String | Unique identifier for the target group or username of the target supergroup | | userId | String | Unique identifier of the target user | + + +### telegramBot.leaveChat(chatId) ⇒ 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) | + * * *