Skip to content

Commit

Permalink
Fix Issue For robot.messageRoom
Browse files Browse the repository at this point in the history
A TypeError was being thrown due to the wrong scope being used when this command was run
  • Loading branch information
phily245 committed Feb 28, 2018
1 parent a430c25 commit 7c3e4be
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/irc.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,21 @@ class IrcBot extends Adapter
# Use @notice if SEND_NOTICE_MODE is set
return @notice envelope, strings if process.env.HUBOT_IRC_SEND_NOTICE_MODE?

target = @_getTargetFromEnvelope envelope
if typeof @_getTargetFromEnvelope == "function"
target = @_getTargetFromEnvelope envelope
else
target = @adapter._getTargetFromEnvelope envelope

unless target
return logger.error "ERROR: Not sure who to send to. envelope=", envelope

for str in strings
logger.debug "#{target} #{str}"
@bot.say target, str

if typeof @bot != "undefined" && typeof @bot.say == "function"
@bot.say target, str
else
@adapter.bot.say target, str

sendPrivate: (envelope, strings...) ->
# Remove the room from the envelope and send as private message to user
Expand Down

0 comments on commit 7c3e4be

Please sign in to comment.