Last active
August 29, 2015 14:26
-
-
Save omnidan/97f15c9f888028c08074 to your computer and use it in GitHub Desktop.
simple coffea irc bot
This file contains hidden or 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
var client = require('coffea')({ | |
host: 'chat.freenode.net', | |
nick: 'coffea-testbot', | |
channels: ['#caffeinery'] | |
}); | |
client.on('command', function (event) { | |
switch (event.cmd) { | |
case 'ping': | |
event.reply('pong'); | |
break; | |
case 'join': | |
if (args.length < 1) { | |
event.reply('not enough arguments: please specify a channel'); | |
break; | |
} | |
event.reply('joining channel'); | |
client.join(args[0], event.network, function () { | |
event.reply('joined channel'); | |
}); | |
break; | |
} | |
console.log(event.channel.name, event.user.nick, event.message); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment