Hubot script for randomly annoying (or encouraging) a user
# Description:
# Chaos monkey. Randomly throws poo or flowers.
#
# Configuration:
# HUBOT_CHAOS_MONKEY_USERS
#
# Dependencies:
# None
#
# Commands:
# None
module.exports = (robot) ->
robot.listen(
(message) -> # Match function
# only match messages with text (ie ignore enter and other events)
return unless message.text
# Grab the users list if it's set. Default to "Shell" for testing
users = process.env.HUBOT_CHAOS_MONKEY_USERS || 'Shell'
users = users.split ","
users[index] = user.trim() for index,user of users
# Occassionally respond to things that Steve says
message.user.name in users and Math.random() > 0.8
(response) -> # Standard listener callback
# Let Steve know how happy you are that he exists
response.emote "<hugs #{response.message.user.name}> :hugging_face:"
response.reply "HI STEVE! YOU'RE MY BEST FRIEND! (but only like #{parseInt(Math.random() * 100, 10)}% of the time)"
)