Skip to content

Instantly share code, notes, and snippets.

@shokai
Created January 17, 2015 03:49
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 shokai/e52dd7fdd5d2592878b0 to your computer and use it in GitHub Desktop.
Save shokai/e52dd7fdd5d2592878b0 to your computer and use it in GitHub Desktop.
# Description:
# notify "star_added" event for slack.com
#
# Author:
# @shokai <hashimoto@shokai.org>
debug = require('debug')('hubot:slack-star')
module.exports = (robot) ->
robot.adapter.client?.on? 'raw_message', (msg) ->
return unless msg.type is 'star_added'
debug msg
return unless msg.item.message.permalink
user = robot.adapter.client.getUserByID msg.user
text = ":star: @#{user.name} added star #{msg.item.message.permalink}"
debug text
robot.send {room: 'stars'}, text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment