npm install ziggyziggy
====

an irc bot in node
``js
var Ziggy = require('ziggy')
, ziggy = Ziggy({
server: 'irc.freenode.net'
, nickname: 'Gushie'
, channels: ['#quantumleap', '#sliderssucks']
})
ziggy.start()
`
Ta-da! You've got a bot online.
What's that? You want it to do something? Oh. Sorry. You can make a plugin for
it!
`js
module.exports = function(ziggy, settings) {
if(settings.respondToPm) {
ziggy.on('pm', function(user, text) {
ziggy.say(user.nick, 'Speak up, I can\'t hear you.')
})
}
ziggy.on('message', function(user, channel, text) {
var bits = text.split(' ')
, command = bits.shift()
if(command === '!reverse') {
ziggy.say(channel, bits.reverse().join(' '))
}
if(command === '!upper') {
ziggy.say(channel, bits.join(' ').toUpperCase())
}
if(command === '!lower') {
ziggy.say(channel, bits.join(' ').toLowerCase())
}
})
}
`
Save something like that as, say, dumb-plugin.js and then modify your main code
a bit.
`js
var Ziggy = require('ziggy')
var dumbPlugin = require('dumb-plugin.js')
, ziggy = Ziggy({
server: 'irc.freenode.org'
, nickname: 'Gushie'
, plugins: [{
name: 'dumb plugin'
, setup: dumbPlugin
, settings: {respondToPm: true}
}]
, channels: ['#quantumleap', '#sliderssucks']
})
ziggy.start()
`
Now we're talkin'. Pretty self-explanatory, but if you configure it as such, it
will respond to all private messages with "Speak up, I can't hear you."
It will also respond to in-channel "commands" like !reverse, !upper, and !lower
with the replies associated.
Better yet, you can look at a fully-functioning example plugin
here.
If you install ziggy globally (npm install -g ziggy), you will magically gainziggy
access to the command that works like this:
ziggy [options]
options are:
* --server, -s IRC server (default irc.freenode.net)--port, -P
* Server port (default 6667)--password
* Server password--secure, -S
* Use secure connection--plugin, -p
* Use ziggy plugin module--nickname, -n
* Set nickname (default ziggy)--channel, -c
* Connect to channel on startup--user, -u
* Add users for Ziggy--version, -v
* Print ziggy version--help, -h
* Print help
Ziggy has a really naive sense of 'users' in so much as it will store a users
object containing their nickname, bot-specific password, their authenticated
status (defaults to true if no password is set), and their userLevel. The
userLevel is pretty much an arbitrary number that can be used to control access
in plugins. So, there really isn't any innate "level heirarchy", just use it in
whatever way makes sense to you. Or don't use it at all. Whatever.
, all of the user information will be passed as the
first argument to callback$3
disconnect bot from IRC with optional message$3
return list of channels$3
get info about channel$3
calls callback with user list$3
return user information$3
get bot level on channel$3
returns text formatted with color$3
change bot's name to newNick$3
set mode on channel where nick is optional$3
shortcut for mode(channel, '+o', nick)$3
shortcut for mode(channel, '-o', nick)$3
add users to the registered users list- accepts an object in the same format as
users in the startup options.$3
send an irc action of text to channel$3
send a notice to a nick or channel$3
send a channel invitation to nick.
channel does not have to exist, but if it does, only users in the channel
are allowed to invite other users. If the channel mode +i is set, only
channel operators may invite other users.$3
update user properties for users in object, same format as users` in theMIT