|
|
|
@ -21,8 +21,13 @@ const deprecate = require('depd')('node-telegram-bot-api'); |
|
|
|
|
|
|
|
|
|
|
|
const _messageTypes = [ |
|
|
|
const _messageTypes = [ |
|
|
|
'text', 'audio', 'document', 'photo', 'sticker', 'video', 'voice', 'contact', |
|
|
|
'text', 'audio', 'document', 'photo', 'sticker', 'video', 'voice', 'contact', |
|
|
|
'location', 'new_chat_participant', 'left_chat_participant', 'new_chat_title', |
|
|
|
'location', 'new_chat_members', 'left_chat_member', 'new_chat_title', |
|
|
|
'new_chat_photo', 'delete_chat_photo', 'group_chat_created', 'successful_payment', 'invoice' |
|
|
|
'new_chat_photo', 'delete_chat_photo', 'group_chat_created', 'game', 'pinned_message', |
|
|
|
|
|
|
|
'migrate_from_chat_id', 'migrate_to_chat_id', 'channel_chat_created', 'supergroup_chat_created', |
|
|
|
|
|
|
|
'successful_payment', 'invoice' |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
const _deprecatedMessageTypes = [ |
|
|
|
|
|
|
|
'new_chat_participant', 'left_chat_participant' |
|
|
|
]; |
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
// enable cancellation
|
|
|
|
// enable cancellation
|
|
|
|
@ -40,6 +45,14 @@ class TelegramBot extends EventEmitter { |
|
|
|
return _messageTypes; |
|
|
|
return _messageTypes; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
on(event, listener) { |
|
|
|
|
|
|
|
if (_deprecatedMessageTypes.indexOf(event) !== -1) { |
|
|
|
|
|
|
|
const url = 'https://github.com/yagop/node-telegram-bot-api/blob/master/doc/usage.md#events'; |
|
|
|
|
|
|
|
deprecate(`Events ${_deprecatedMessageTypes.join(',')} are deprecated. See the updated list of events: ${url}`); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
super.on(event, listener); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Both request method to obtain messages are implemented. To use standard polling, set `polling: true` |
|
|
|
* Both request method to obtain messages are implemented. To use standard polling, set `polling: true` |
|
|
|
* on `options`. Notice that [webHook](https://core.telegram.org/bots/api#setwebhook) will need a SSL certificate.
|
|
|
|
* on `options`. Notice that [webHook](https://core.telegram.org/bots/api#setwebhook) will need a SSL certificate.
|
|
|
|
|