Skip to content

Instantly share code, notes, and snippets.

@omnidan
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omnidan/97f15c9f888028c08074 to your computer and use it in GitHub Desktop.
Save omnidan/97f15c9f888028c08074 to your computer and use it in GitHub Desktop.
simple coffea irc bot
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