Skip to content

Instantly share code, notes, and snippets.

@shokai
Created August 20, 2014 13:27
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/2362381d4e3d26055a40 to your computer and use it in GitHub Desktop.
Save shokai/2362381d4e3d26055a40 to your computer and use it in GitHub Desktop.
# 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