From 88f0f311945829e938209836e3bceb1263f92c72 Mon Sep 17 00:00:00 2001 From: Aaron Ogle Date: Sun, 6 Aug 2017 16:27:35 -0500 Subject: [PATCH 1/2] don't try and get room name for dm or livechat --- src/rocketchat.coffee | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/rocketchat.coffee b/src/rocketchat.coffee index bab16e833..ee865b4e6 100644 --- a/src/rocketchat.coffee +++ b/src/rocketchat.coffee @@ -164,10 +164,13 @@ class RocketChatBotAdapter extends Adapter user = @robot.brain.userForId newmsg.u._id, name: newmsg.u.username, alias: newmsg.alias @chatdriver.checkMethodExists("getRoomNameById").then(() => - return @chatdriver.getRoomName(newmsg.rid).then((roomName) => - @robot.logger.info("setting roomName: #{roomName}") - user.room = roomName - ) + if not isDM and not isLC + return @chatdriver.getRoomName(newmsg.rid).then((roomName) => + @robot.logger.info("setting roomName: #{roomName}") + user.room = roomName + ) + else + return Q() ).catch((err) => return Q() ).then(() => From f5a769b978f3b594bd4dfa509248c817f401fd95 Mon Sep 17 00:00:00 2001 From: Aaron Ogle Date: Sun, 6 Aug 2017 16:56:48 -0500 Subject: [PATCH 2/2] Add roomid when room name can't be got --- src/rocketchat.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/rocketchat.coffee b/src/rocketchat.coffee index ee865b4e6..b98e2faff 100644 --- a/src/rocketchat.coffee +++ b/src/rocketchat.coffee @@ -170,8 +170,10 @@ class RocketChatBotAdapter extends Adapter user.room = roomName ) else + user.room = newmsg.rid return Q() ).catch((err) => + user.room = newmsg.rid return Q() ).then(() => user.roomID = newmsg.rid