Last active
December 9, 2015 19:28
-
-
Save hlung/4317058 to your computer and use it in GitHub Desktop.
Let's make Hubot say what you want in a particular room! :D
This file contains hidden or 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: | |
# Let's make Hubot say what you want in a particular room! :D | |
# | |
# Dependencies: | |
# - | |
# | |
# Configuration: | |
# - | |
# | |
# Commands: | |
# room <roomname> say <msg> | |
# room standup say everyone please standup! | |
# | |
# Author: | |
# [email protected] (Fri 13 Dec 2012) | |
# MIT License | |
# | |
#------------------------------------------------- | |
_bot = null | |
# -------------------- | |
# Get robot var for using in sending messages later on. | |
# -------------------- | |
module.exports = (robot) -> | |
_bot = robot | |
robot.respond /room (.+) say (.+)/i, (msg) -> | |
roomsay(msg.match[1],msg.match[2]) | |
# This also works after bot joins the room. | |
# So you can call it inside some CronJob or setInterval(fun,dur,obj) | |
# -------------------- | |
roomsay = (roomname,strings) -> | |
#ROOM_RPY = { "reply_to": '[email protected]' } | |
ROOM_RPY = { "reply_to": "13184_#{roomname.toLowerCase()}@conf.hipchat.com" } | |
_bot.send(ROOM_RPY, strings) if strings | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment