Advertisement
Guest User

Untitled

a guest
May 29th, 2015
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. # Description:
  2. # 外部Bot/API経由の特定の発言を受け取って別のアクションを実行する
  3. #
  4. # Dependencies:
  5. # None
  6. #
  7. # Configuration:
  8. # None
  9. #
  10. # Commands:
  11. # None
  12.  
  13. module.exports = (robot) ->
  14. robot.adapter.client?.on? 'raw_message', (msg) ->
  15. return if msg.type isnt 'message' || msg.subtype isnt 'bot_message'
  16. return unless msg.attachments
  17. match = msg.attachments[0].fallback.match(/Failed: (.+?)'s build/)
  18. return if match is null
  19. commit_user = match[1]
  20. channel = robot.adapter.client.getChannelByID msg.channel
  21. # プライベートチャンネルは取得出来ないためundefinedが返される
  22. return if channel is undefined
  23. text = "@#{commit_user} テストが落ちたよー!"
  24. robot.send {room: "##{channel.name}"}, text
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement