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