mirror of
https://github.com/yagop/node-telegram-bot-api
synced 2025-08-28 21:07:39 +00:00
Add 'edited_message' event
Notes: Merge branch 'master' of https://github.com/chris54721/node-telegram-bot-api into pr/191 References: * PR #191: https://github.com/yagop/node-telegram-bot-api/pull/191
This commit is contained in:
commit
8dc3fe82ef
@ -35,6 +35,7 @@ There are some other examples on [examples](https://github.com/yagop/node-telegr
|
|||||||
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.
|
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 `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)
|
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 `edited_message` when a message is edited, and also `edited_message_text` or `edited_message_caption` depending on which type of message was edited.
|
||||||
* * *
|
* * *
|
||||||
|
|
||||||
### WebHooks
|
### WebHooks
|
||||||
|
@ -35,6 +35,7 @@ There are some other examples on [examples](https://github.com/yagop/node-telegr
|
|||||||
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.
|
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 `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)
|
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 `edited_message` when a message is edited, and also `edited_message_text` or `edited_message_caption` depending on which type of message was edited.
|
||||||
* * *
|
* * *
|
||||||
|
|
||||||
### WebHooks
|
### WebHooks
|
||||||
|
@ -82,6 +82,7 @@ class TelegramBot extends EventEmitter {
|
|||||||
processUpdate(update) {
|
processUpdate(update) {
|
||||||
debug('Process Update %j', update);
|
debug('Process Update %j', update);
|
||||||
const message = update.message;
|
const message = update.message;
|
||||||
|
const editedMessage = update.edited_message;
|
||||||
const inlineQuery = update.inline_query;
|
const inlineQuery = update.inline_query;
|
||||||
const chosenInlineResult = update.chosen_inline_result;
|
const chosenInlineResult = update.chosen_inline_result;
|
||||||
const callbackQuery = update.callback_query;
|
const callbackQuery = update.callback_query;
|
||||||
@ -120,6 +121,15 @@ class TelegramBot extends EventEmitter {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} else if (editedMessage) {
|
||||||
|
debug('Process Update edited_message %j', editedMessage);
|
||||||
|
this.emit('edited_message', editedMessage);
|
||||||
|
if (editedMessage.text) {
|
||||||
|
this.emit('edited_message_text', editedMessage);
|
||||||
|
}
|
||||||
|
if (editedMessage.caption) {
|
||||||
|
this.emit('edited_message_caption', editedMessage);
|
||||||
|
}
|
||||||
} else if (inlineQuery) {
|
} else if (inlineQuery) {
|
||||||
debug('Process Update inline_query %j', inlineQuery);
|
debug('Process Update inline_query %j', inlineQuery);
|
||||||
this.emit('inline_query', inlineQuery);
|
this.emit('inline_query', inlineQuery);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user