mirror of
https://github.com/yagop/node-telegram-bot-api
synced 2025-08-29 05:17:41 +00:00
src/telegram: Add API v3 new update types and message sub-types (#333)
References: * API changelog: https://core.telegram.org/bots/api-changelog#may-18-2017 * PR: https://github.com/yagop/node-telegram-bot-api/pull/333 * PR-by: @kamikazechaser * API v3: https://github.com/yagop/node-telegram-bot-api/issues/332
This commit is contained in:
parent
cda9d8d597
commit
177c951340
@ -15,7 +15,8 @@
|
||||
events will **ALSO** be emitted: `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`
|
||||
`new_chat_photo`, `delete_chat_photo`, `group_chat_created`,
|
||||
`successful_payment`, `invoice`
|
||||
1. `callback_query`: Received a new incoming [Callback Query][callback-query]
|
||||
1. `inline_query`: Received a new incoming [Inline Query][inline-query]
|
||||
1. `chosen_inline_result`: Received result of an inline query i.e. [ChosenInlineResult][chosen-inline-result]
|
||||
@ -26,6 +27,8 @@
|
||||
1. `edited_channel_post`: Received a new version of a channel post that is known to the bot and was edited
|
||||
1. `edited_channel_post_text`
|
||||
1. `edited_channel_post_caption`
|
||||
1. `shipping_query`: Received a new incoming shipping query
|
||||
1. `pre_checkout_query`: Received a new incoming pre-checkout query
|
||||
1. `polling_error`: Error occurred during polling. See [polling errors](#polling-errors).
|
||||
1. `webhook_error`: Error occurred handling a webhook request. See [webhook errors](#webhook-errors).
|
||||
|
||||
|
@ -22,7 +22,7 @@ const deprecate = require('depd')('node-telegram-bot-api');
|
||||
const _messageTypes = [
|
||||
'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'
|
||||
'new_chat_photo', 'delete_chat_photo', 'group_chat_created', 'successful_payment', 'invoice'
|
||||
];
|
||||
|
||||
// enable cancellation
|
||||
@ -454,6 +454,8 @@ class TelegramBot extends EventEmitter {
|
||||
const inlineQuery = update.inline_query;
|
||||
const chosenInlineResult = update.chosen_inline_result;
|
||||
const callbackQuery = update.callback_query;
|
||||
const shippingQuery = update.shipping_query;
|
||||
const preCheckoutQuery = update.pre_checkout_query;
|
||||
|
||||
if (message) {
|
||||
debug('Process Update message %j', message);
|
||||
@ -524,6 +526,12 @@ class TelegramBot extends EventEmitter {
|
||||
} else if (callbackQuery) {
|
||||
debug('Process Update callback_query %j', callbackQuery);
|
||||
this.emit('callback_query', callbackQuery);
|
||||
} else if (shippingQuery) {
|
||||
debug('Process Update shipping_query %j', shippingQuery);
|
||||
this.emit('shipping_query', shippingQuery);
|
||||
} else if (preCheckoutQuery) {
|
||||
debug('Process Update pre_checkout_query %j', preCheckoutQuery);
|
||||
this.emit('pre_checkout_query', preCheckoutQuery);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user