Created
August 20, 2014 13:27
-
-
Save shokai/2362381d4e3d26055a40 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
# Description: | |
# hubot anonymous post | |
# | |
# Commands: | |
# hubot anon MESSAGE | |
# hubot anon #general MESSAGE | |
# | |
# Author: | |
# @shokai | |
config = | |
to: '#general' | |
module.exports = (robot) -> | |
robot.respond /anon (.+)$/i, (msg) -> | |
from = msg.message.user.name | |
args = msg.match[1].trim().split(/\s+/) | |
if /[#@][a-zA-Z0-9_\-]+/.test args[0] | |
to = args.shift() | |
else | |
to = config.to | |
text = args.join(' ') | |
robot.send {room: to}, text | |
msg.send "@#{from} #{to} にこっそり「#{text}」って言っておきました" | |
return | |
robot.respond /anon$/i, (msg) -> | |
msg.send """ | |
hubot anon MESSAGE | |
hubot anon [to] MESSAGE | |
hubot anon #general MESSAGE | |
""" | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment