Closed WaleedAshraf closed 8 years ago
I'd accept that PR if someone could confirm that it works for both slack and irc :)
Well Im just confirming that does it happens every where? Or is just me facing this issue?
Slack adaptor has some different behaviour than IRC adaptor in relation to room id's, so while I haven't used this script on slack, it sounds about right
Right, I added slack channel name against id in hubot brain.
@WaleedAshraf what did you do to accomplish this? Thanks.
@dgautsch When ever my bot joins a new channel, I call this method,
robot.respond /channel add (.+)$/i, (msg) ->
channelName = msg.match[1]
channelID = msg.message.room
console.log "Starting channel add: #{channelID} : #{channelName}"
try
robot.brain.set channelID, channelName
catch err
return msg.send err
msg.send "Channel Added!"
and then modified seen script a bit, as
lastRoom = robot.brain.get last.chan
if(lastRoom)
msg.send "#{nick} was last seen in ##{lastRoom} #{date_string}"
else
msg.send "#{nick} was last seen #{date_string}"
check it here: https://github.com/WaleedAshraf/caari/blob/staging/scripts/seen.coffee#L90
Right now bot prints slack channel ID i.e xwy was last seen in G1YLK964G less than a minute ago
can't we convert channel id to channel name?