Created
April 15, 2013 18:13
-
-
Save wixo/5390083 to your computer and use it in GitHub Desktop.
welcome.coffee para rambot en #limaJS
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: | |
# Send a welcome message to first time users | |
# | |
# Dependencies: | |
# None | |
# | |
# Configuration: | |
# None | |
# | |
# Commands: | |
# hubot welcome <message> | |
# | |
# Author: | |
# Christian Vermeulen | |
# info@christianvermeulen.net | |
module.exports = (robot) -> | |
robot.brain.on 'loaded', => | |
robot.brain.data.welcomeUsers ||= [] | |
robot.brain.data.welcomeMsg ||= "Bienvenid@ a #limaJS, una congregación del Church of NaN, también conocida como: python.js, el club del debate y AA." | |
robot.respond /welcome (.*)/i, (msg) -> | |
robot.brain.data.welcomeMsg = msg.match[1] | |
robot.brain.data.welcomeUsers = [] | |
msg.send "ok!" | |
robot.hear /./i, (msg) -> | |
welcomeUsers = robot.brain.data.welcomeUsers | |
if msg.message.user.name not in welcomeUsers | |
welcomeUsers.push(msg.message.user.name) | |
msg.send "Hola "+msg.message.user.name+", "+robot.brain.data.welcomeMsg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment