Open ulope opened 6 years ago
I've discovered that Meteor.call()
is available in internal hubot scripts but unfortunately it doesn't seem possible to use as a replacement.
The following test bot results in an error-invalid-user
error:
module.exports = function(robot) {
robot.respond(/test/i, function(msg) {
Meteor.call(
'updateMessage',
{
_id: msg.message.id,
rid: msg.message.room,
msg: 'bla'
}
);
});
};
Log:
Exception in callback of async function: Error: Invalid user [error-invalid-user]
at MethodInvocation.updateMessage (/app/bundle/programs/server/packages/rocketchat_lib.js:16731:13)
at MethodInvocation.methodsMap.(anonymous function) (/app/bundle/programs/server/packages/rocketchat_lib.js:2186:28)
at MethodInvocation.methodMap.(anonymous function) (packages/rocketchat_monitoring.js:2731:30)
at maybeAuditArgumentChecks (/app/bundle/programs/server/packages/ddp-server.js:1877:12)
at DDP._CurrentMethodInvocation.withValue (/app/bundle/programs/server/packages/ddp-server.js:1804:100)
at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1186:12)
at resolve (/app/bundle/programs/server/packages/ddp-server.js:1804:72)
at new Promise (<anonymous>:null:null)
at Server.applyAsync (/app/bundle/programs/server/packages/ddp-server.js:1804:12)
at Server.apply (/app/bundle/programs/server/packages/ddp-server.js:1740:26)
at Server.call (/app/bundle/programs/server/packages/ddp-server.js:1724:17)
at /hubot/scripts/testx4.js:3:16
at runWithEnvironment (packages/meteor.js:1238:24)
at packages/meteor.js:1251:14
at runWithEnvironment (packages/meteor.js:1238:24)
=> awaited here:
at Promise.await (/app/bundle/programs/server/npm/node_modules/meteor/promise/node_modules/meteor-promise/promise_server.js:60:12)
at Server.apply (/app/bundle/programs/server/packages/ddp-server.js:1749:27)
at Server.call (/app/bundle/programs/server/packages/ddp-server.js:1724:17)
at /hubot/scripts/testx4.js:3:16
at runWithEnvironment (packages/meteor.js:1238:24)
at packages/meteor.js:1251:14
at runWithEnvironment (packages/meteor.js:1238:24)
Description:
I'm trying to replicate RocketChat/hubot-rocketchat#126 with the internal hubot.
The regular hubot-rocketchat adapter supports a
callMethod
extension that allows to call arbitrary meteor methods. This appears to be missing from the internal hubot adapter making it much less useful.Server Setup Information: