Skip to content

Commit

Permalink
Merge pull request #232 from RocketChat/no-room-name-for-dm
Browse files Browse the repository at this point in the history
don't try and get room name for dm or livechat
  • Loading branch information
Sing-Li authored Aug 6, 2017
2 parents 2192b1a + f5a769b commit 1a6ea04
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/rocketchat.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,16 @@ 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
user.room = newmsg.rid
return Q()
).catch((err) =>
user.room = newmsg.rid
return Q()
).then(() =>
user.roomID = newmsg.rid
Expand Down

0 comments on commit 1a6ea04

Please sign in to comment.