Created
March 14, 2016 02:39
-
-
Save yukirii/44077756d0c63ec17012 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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