Skip to content

Instantly share code, notes, and snippets.

@yukirii
Created March 14, 2016 02:39
Show Gist options
  • Save yukirii/44077756d0c63ec17012 to your computer and use it in GitHub Desktop.
Save yukirii/44077756d0c63ec17012 to your computer and use it in GitHub Desktop.
module.exports = (robot) ->
botId = robot.adapter.client.getUserByName('mybot').id
robot.adapter.client?.on? 'raw_message', (msg) ->
if msg['type'] != 'reaction_added' && msg['type'] != 'reaction_removed'
return
if msg['item_user'] == botId && msg['type'] == 'reaction_added'
reaction = msg['reaction']
channel = msg['item']['channel']
if reaction == '+1' || reaction == 'thumbsup'
user = robot.adapter.client.getUserByID(msg.user)
robot.send { room: channel }, "@#{user.name}: あざっす :thumbsup:"
else
robot.send { room: channel }, ":#{reaction}:"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment