diff --git a/index.js b/index.js index 4d03c0a..4405d60 100644 --- a/index.js +++ b/index.js @@ -4,10 +4,11 @@ const regex = /^\/([^@\s]+)@?(?:(\S+)|)\s?([\s\S]+)?$/i; /* eslint no-param-reassign: ["error", { "props": false }] */ module.exports = () => mount('text', (ctx, next) => { - const parts = regex.exec(ctx.message.text.trim()); + const messageText = ctx.updateType === 'channel_post' ? ctx.channelPost.text : ctx.message.text; + const parts = regex.exec(messageText); if (!parts) return next(); const command = { - text: ctx.message.text, + text: messageText, command: parts[1], bot: parts[2], args: parts[3],