hubot-scripts
Version:
Allows you to opt in to a variety of scripts
32 lines (26 loc) • 644 B
text/coffeescript
# Description:
# "Simple path to have Hubot echo out anything in the message querystring for a given room."
#
# Dependencies:
# "querystring": "0.1.0"
#
# Configuration:
# None
#
# Commands:
# None
#
# URLs:
# GET /hubot/say?message=<message>[&room=<room>&type=<type]
#
# Authors:
# ajacksified
querystring = require('querystring')
module.exports = (robot) ->
robot.router.get "/hubot/say", (req, res) ->
query = querystring.parse(req._parsedUrl.query)
user = {}
user.room = query.room if query.room
user.type = query.type if query.type
robot.send(user, query.message)
res.end "Said #{query.message}"