diff --git a/doc/usage.md b/doc/usage.md index 7f6c924..42136f3 100644 --- a/doc/usage.md +++ b/doc/usage.md @@ -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). diff --git a/src/telegram.js b/src/telegram.js index 8460f38..49769a2 100644 --- a/src/telegram.js +++ b/src/telegram.js @@ -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); } }