Skip to content

Instantly share code, notes, and snippets.

@buritica
Forked from mattetti/gist:5088362
Last active December 14, 2015 12:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save buritica/5088372 to your computer and use it in GitHub Desktop.
Save buritica/5088372 to your computer and use it in GitHub Desktop.
module.exports = (robot) ->
robot.brain.data.tell_messages ?= {}
localstorage = robot.brain.data.tell_messages
robot.respond /tell ([\w.-]*) (.*)/i, (msg) ->
datetime = new Date()
tellmessage = msg.match[1] + ": " + msg.message.user.name + " @ " + datetime.toTimeString() + " said: " + msg.match[2] + "\r\n"
if localstorage[msg.match[1]] == undefined
localstorage[msg.match[1]] = tellmessage
else
localstorage[msg.match[1]] += tellmessage
msg.send "@" + msg.message.user.name + ": Sodesu sensei sama!"
return
robot.hear /./i, (msg) ->
# just send the messages if they are available...
if localstorage[msg.message.user.name] != undefined
tellmessage = localstorage[msg.message.user.name]
delete localstorage[msg.message.user.name]
msg.send tellmessage
return
## irc HACK
robot.on 'join', (channel, who) ->
console.log who
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment