Skip to content

Instantly share code, notes, and snippets.

@ConnorWGarvey
Last active December 20, 2015 06:59
Show Gist options
  • Save ConnorWGarvey/6089889 to your computer and use it in GitHub Desktop.
Save ConnorWGarvey/6089889 to your computer and use it in GitHub Desktop.
IRC commands for Hubot
# Description:
# Anyone can have voice or op
#
# Commands:
# hubot make me an op
# hubot make <name> an op
# hubot give me voice
# hubot give <name> voice
module.exports = (robot) ->
robot.respond /make me an op$/i, (msg) ->
robot.adapter.command('MODE', msg.message.user.room, '+o', msg.message.user.name)
robot.respond /make @?([\w .\-_]+) an op$/i, (msg) ->
robot.adapter.command('MODE', msg.message.user.room, '+o', msg.match[1].trim())
robot.respond /give me voice$/i, (msg) ->
robot.adapter.command('MODE', msg.message.user.room, '+v', msg.message.user.name)
robot.respond /give @?([\w .\-_]+) voice$/i, (msg) ->
robot.adapter.command('MODE', msg.message.user.room, '+v', msg.match[1].trim())
# Automatically give everyone voice and op (as an example)
robot.enter (msg) ->
robot.adapter.command('MODE', msg.message.user.room, '+v', msg.message.user.name)
robot.adapter.command('MODE', msg.message.user.room, '+o', msg.message.user.name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment