Skip to content

Instantly share code, notes, and snippets.

@wixo
Created April 15, 2013 18:13
Show Gist options
  • Save wixo/5390083 to your computer and use it in GitHub Desktop.
Save wixo/5390083 to your computer and use it in GitHub Desktop.
welcome.coffee para rambot en #limaJS
# 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