diff --git a/providers/nodebb/chat.js b/providers/nodebb/chat.js index e66f74cd..a1fcb9c6 100644 --- a/providers/nodebb/chat.js +++ b/providers/nodebb/chat.js @@ -449,7 +449,8 @@ exports.bindChat = function bindChat(forum) { post: -1, topic: -1, user: message.from.id, - room: message.room + room: message.room, + chat: message.id }; return forum.Commands.get(ids, message.content, (content) => message.reply(content)) .then((command) => command.execute()); diff --git a/providers/nodebb/notification.js b/providers/nodebb/notification.js index 55cc5ca2..8a7d45d3 100644 --- a/providers/nodebb/notification.js +++ b/providers/nodebb/notification.js @@ -379,7 +379,8 @@ exports.bindNotification = function bindNotification(forum) { post: notification.postId, topic: notification.topicId, user: notification.userId, - room: -1 + room: -1, + chat: -1 }; return notification.getText() .then((postData) => forum.Commands.get(ids, diff --git a/test/providers/nodebb/chatTests.js b/test/providers/nodebb/chatTests.js index c776eb30..4bfbc76f 100644 --- a/test/providers/nodebb/chatTests.js +++ b/test/providers/nodebb/chatTests.js @@ -1058,6 +1058,8 @@ describe('providers/nodebb/chat', () => { }); }); it('should provide expected ids to Commands parsing', () => { + const chatId = Math.random(); + message.id = chatId; const roomId = Math.random(); message.room = roomId; const userId = Math.random(); @@ -1066,11 +1068,12 @@ describe('providers/nodebb/chat', () => { message: 1 }).then(() => { const param = forum.Commands.get.firstCall.args[0]; - param.should.have.all.keys('post', 'topic', 'user', 'room'); + param.should.have.all.keys('post', 'topic', 'user', 'room', 'chat'); param.post.should.equal(-1); param.topic.should.equal(-1); param.user.should.equal(userId); param.room.should.equal(roomId); + param.chat.should.equal(chatId); }); }); it('should provide message content to commands parsing', () => { diff --git a/test/providers/nodebb/notificationTest.js b/test/providers/nodebb/notificationTest.js index be0203c4..a02b013d 100644 --- a/test/providers/nodebb/notificationTest.js +++ b/test/providers/nodebb/notificationTest.js @@ -598,7 +598,8 @@ describe('providers/nodebb/notification', () => { post: post, topic: topic, user: user, - room: -1 + room: -1, + chat: -1 }); args[1].should.eql(text); args[2].should.be.a('function');