I'm using Borpress 10.51.2 with botpress-channel-rocketchat 0.0.14 and @botpress/hitl 10.51.8
Receiving messages in the hitl modul over the rocketchat channel is no problem but I can't send private messages from the hitl modul back to rocketchat. When sending a message via the hitl module, the following error occurs in the botpress log:
13:48:56 - error: Unhandled Rejection in Promise: Promise {
_bitField: 18087936,
_fulfillmentHandler0:
TypeError: Cannot read property 'roomType' of undefined
at RocketChat.sendMessage (/root/my-bot/diary1/node_modules/botpress-channel-rocketchat/bin/webpack:/src/rocketchat.js:110:43)
at Object.handleText [as text] (/root/my-bot/diary1/node_modules/botpress-channel-rocketchat/bin/webpack:/src/outgoing.js:25:48)
at _callee$ (/root/my-bot/diary1/node_modules/botpress-channel-rocketchat/bin/webpack:/src/index.js:18:9)
at tryCatch (/root/my-bot/diary1/node_modules/regenerator-runtime/runtime.js:65:40)
at Generator.invoke [as _invoke] (/root/my-bot/diary1/node_modules/regenerator-runtime/runtime.js:303:22)
at Generator.prototype.(anonymous function) [as next] (/root/my-bot/diary1/node_modules/regenerator-runtime/runtime.js:117:21)
at step (/root/my-bot/diary1/node_modules/botpress-channel-rocketchat/bin/node.bundle.js:252:202)
at /root/my-bot/diary1/node_modules/botpress-channel-rocketchat/bin/node.bundle.js:252:459
at Promise._execute (/root/my-bot/diary1/node_modules/bluebird/js/release/debuggability.js:313:9)
at Promise._resolveFromExecutor (/root/my-bot/diary1/node_modules/bluebird/js/release/promise.js:483:18)
at new Promise (/root/my-bot/diary1/node_modules/bluebird/js/release/promise.js:79:10)
at /root/my-bot/diary1/node_modules/botpress-channel-rocketchat/bin/node.bundle.js:252:99
at outgoingMiddleware (/root/my-bot/diary1/node_modules/botpress-channel-rocketchat/bin/webpack:/src/index.js:10:7)
at exec (/root/my-bot/diary1/node_modules/mware/index.js:50:23)
at next (/root/my-bot/diary1/node_modules/mware/index.js:60:9)
at _callee$ (/root/my-bot/diary1/node_modules/@botpress/channel-web/bin/webpack:/src/socket.js:30:14)
at tryCatch (/root/my-bot/diary1/node_modules/regenerator-runtime/runtime.js:65:40)
at Generator.invoke [as _invoke] (/root/my-bot/diary1/node_modules/regenerator-runtime/runtime.js:303:22)
at Generator.prototype.(anonymous function) [as next] (/root/my-bot/diary1/node_modules/regenerator-runtime/runtime.js:117:21)
at step (/root/my-bot/diary1/node_modules/@botpress/channel-web/bin/node.bundle.js:2387:202)
at /root/my-bot/diary1/node_modules/@botpress/channel-web/bin/node.bundle.js:2387:459
at Promise._execute (/root/my-bot/diary1/node_modules/bluebird/js/release/debuggability.js:313:9),
_rejectionHandler0: undefined,
_promise0: undefined,
_receiver0: undefined } Reason:
{ message: 'Cannot read property \'roomType\' of undefined',
stack:
'TypeError: Cannot read property \'roomType\' of undefined\n at RocketChat.sendMessage (/root/my-bot/diary1/node_modules/botpress-channel-rocketchat/bin/webpack:/src/rocketchat.js:110:43)\n at Object.handleText [as text] (/root/my-bot/diary1/node_modules/botpress-channel-rocketchat/bin/webpack:/src/outgoing.js:25:48)\n at _callee$ (/root/my-bot/diary1/node_modules/botpress-channel-rocketchat/bin/webpack:/src/index.js:18:9)\n at tryCatch (/root/my-bot/diary1/node_modules/regenerator-runtime/runtime.js:65:40)\n at Generator.invoke [as _invoke] (/root/my-bot/diary1/node_modules/regenerator-runtime/runtime.js:303:22)\n at Generator.prototype.(anonymous function) [as next] (/root/my-bot/diary1/node_modules/regenerator-runtime/runtime.js:117:21)\n at step (/root/my-bot/diary1/node_modules/botpress-channel-rocketchat/bin/node.bundle.js:252:202)\n at /root/my-bot/diary1/node_modules/botpress-channel-rocketchat/bin/node.bundle.js:252:459\n at Promise._execute (/root/my-bot/diary1/node_modules/bluebird/js/release/debuggability.js:313:9)\n at Promise._resolveFromExecutor (/root/my-bot/diary1/node_modules/bluebird/js/release/promise.js:483:18)\n at new Promise (/root/my-bot/diary1/node_modules/bluebird/js/release/promise.js:79:10)\n at /root/my-bot/diary1/node_modules/botpress-channel-rocketchat/bin/node.bundle.js:252:99\n at outgoingMiddleware (/root/my-bot/diary1/node_modules/botpress-channel-rocketchat/bin/webpack:/src/index.js:10:7)\n at exec (/root/my-bot/diary1/node_modules/mware/index.js:50:23)\n at next (/root/my-bot/diary1/node_modules/mware/index.js:60:9)\n at _callee$ (/root/my-bot/diary1/node_modules/@botpress/channel-web/bin/webpack:/src/socket.js:30:14)\n at tryCatch (/root/my-bot/diary1/node_modules/regenerator-runtime/runtime.js:65:40)\n at Generator.invoke [as _invoke] (/root/my-bot/diary1/node_modules/regenerator-runtime/runtime.js:303:22)\n at Generator.prototype.(anonymous function) [as next] (/root/my-bot/diary1/node_modules/regenerator-runtime/runtime.js:117:21)\n at step (/root/my-bot/diary1/node_modules/@botpress/channel-web/bin/node.bundle.js:2387:202)\n at /root/my-bot/diary1/node_modules/@botpress/channel-web/bin/node.bundle.js:2387:459\n at Promise._execute (/root/my-bot/diary1/node_modules/bluebird/js/release/debuggability.js:313:9)' }
13:48:56 - error: TypeError: Cannot read property 'roomType' of undefined
at RocketChat.sendMessage (/root/my-bot/diary1/node_modules/botpress-channel-rocketchat/bin/webpack:/src/rocketchat.js:110:43)
at Object.handleText [as text] (/root/my-bot/diary1/node_modules/botpress-channel-rocketchat/bin/webpack:/src/outgoing.js:25:48)
at _callee$ (/root/my-bot/diary1/node_modules/botpress-channel-rocketchat/bin/webpack:/src/index.js:18:9)
at tryCatch (/root/my-bot/diary1/node_modules/regenerator-runtime/runtime.js:65:40)
at Generator.invoke [as _invoke] (/root/my-bot/diary1/node_modules/regenerator-runtime/runtime.js:303:22)
at Generator.prototype.(anonymous function) [as next] (/root/my-bot/diary1/node_modules/regenerator-runtime/runtime.js:117:21)
at step (/root/my-bot/diary1/node_modules/botpress-channel-rocketchat/bin/node.bundle.js:252:202)
at /root/my-bot/diary1/node_modules/botpress-channel-rocketchat/bin/node.bundle.js:252:459
at Promise._execute (/root/my-bot/diary1/node_modules/bluebird/js/release/debuggability.js:313:9)
at Promise._resolveFromExecutor (/root/my-bot/diary1/node_modules/bluebird/js/release/promise.js:483:18)
at new Promise (/root/my-bot/diary1/node_modules/bluebird/js/release/promise.js:79:10)
at /root/my-bot/diary1/node_modules/botpress-channel-rocketchat/bin/node.bundle.js:252:99
at outgoingMiddleware (/root/my-bot/diary1/node_modules/botpress-channel-rocketchat/bin/webpack:/src/index.js:10:7)
at exec (/root/my-bot/diary1/node_modules/mware/index.js:50:23)
at next (/root/my-bot/diary1/node_modules/mware/index.js:60:9)
at _callee$ (/root/my-bot/diary1/node_modules/@botpress/channel-web/bin/webpack:/src/socket.js:30:14)
at tryCatch (/root/my-bot/diary1/node_modules/regenerator-runtime/runtime.js:65:40)
at Generator.invoke [as _invoke] (/root/my-bot/diary1/node_modules/regenerator-runtime/runtime.js:303:22)
at Generator.prototype.(anonymous function) [as next] (/root/my-bot/diary1/node_modules/regenerator-runtime/runtime.js:117:21)
at step (/root/my-bot/diary1/node_modules/@botpress/channel-web/bin/node.bundle.js:2387:202)
at /root/my-bot/diary1/node_modules/@botpress/channel-web/bin/node.bundle.js:2387:459
at Promise._execute (/root/my-bot/diary1/node_modules/bluebird/js/release/debuggability.js:313:9)
Imho the bug occurs, because the event object does not contain the relevant information to send the message. I logged the event object to console in the src/rocketchat.js:sendMessage() function:
Obviously event.raw.options.roomType, event.raw.channelId and event.raw.options.user.username are not set in src/rocketchat.js:sendMessage() and thus the message can't be send.
Can the required values get extracted from somewhere else or is it possible to use defaults, if the fields are not set?
I would implement a solution however I'm not sure how a good solution could look like ^^
I'm using Borpress 10.51.2 with botpress-channel-rocketchat 0.0.14 and @botpress/hitl 10.51.8
Receiving messages in the hitl modul over the rocketchat channel is no problem but I can't send private messages from the hitl modul back to rocketchat. When sending a message via the hitl module, the following error occurs in the botpress log:
Imho the bug occurs, because the event object does not contain the relevant information to send the message. I logged the event object to console in the src/rocketchat.js:sendMessage() function:
Obviously
event.raw.options.roomType
,event.raw.channelId
andevent.raw.options.user.username
are not set in src/rocketchat.js:sendMessage() and thus the message can't be send.Can the required values get extracted from somewhere else or is it possible to use defaults, if the fields are not set?
I would implement a solution however I'm not sure how a good solution could look like ^^