diff --git a/lib/mvc/Scope.js b/lib/mvc/Scope.js index ceebb51..aba96f6 100755 --- a/lib/mvc/Scope.js +++ b/lib/mvc/Scope.js @@ -43,7 +43,7 @@ class Scope { this._isEditedMessage = update.editedMessage ? true : false - this._message = update.message || update.editedMessage + this._message = update.message || update.editedMessage || update.channelPost this._chatId = this._message.chat.id this._userId = this._message.from.id this._fromGroupChat = !(this._userId === this._chatId) @@ -96,6 +96,14 @@ class Scope { get chatId() { return this._chatId } + + /** + * + * @returns {Message} + */ + get channelPost() { + return this._channelPost + } /** * diff --git a/lib/updateProcessors/MessageUpdateProcessor.js b/lib/updateProcessors/MessageUpdateProcessor.js index 72a5203..9bff274 100755 --- a/lib/updateProcessors/MessageUpdateProcessor.js +++ b/lib/updateProcessors/MessageUpdateProcessor.js @@ -21,8 +21,8 @@ class MessageUpdateProcessor extends BaseUpdateProcessor { * @param {Update} update */ process(update) { - if (update.message || update.editedMessage) { - let message = update.message || update.editedMessage + if (update.message || update.editedMessage || update.channelPost) { + let message = update.message || update.editedMessage || update.channelPost let scope = new Scope( update, @@ -107,7 +107,7 @@ class MessageUpdateProcessor extends BaseUpdateProcessor { * @param {Update} update */ supports(update) { - return !!(update.message || update.editedMessage || update.callbackQuery) + return !!(update.message || update.editedMessage || update.callbackQuery || update.channelPost) } /** @@ -127,4 +127,4 @@ class MessageUpdateProcessor extends BaseUpdateProcessor { } } -module.exports = MessageUpdateProcessor \ No newline at end of file +module.exports = MessageUpdateProcessor