Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import org.jibble.pircbot.*;
// http://www.jibble.org/pircbot.php
class GroovyBot extends PircBot {
def users = ["base698"];
public GroovyBot() {
this.setName("GroovyBot");
}
public void onMessage(String channel, String sender,
String login, String hostname, String message) {
def strDate = new Date().format('MM-dd-yy-')
def filename = strDate + channel.substring(1) + ".html";
File f = new File(filename);
Date d = new Date();
def msg = "${sender} (${d.toString()}): ${message}<br>\n";
println msg
f.append(msg);
f.close();
}
public void onJoin(String channel, String sender, String login, String hostname) {
}
static def startBot() {
// Now start our bot up.
GroovyBot bot = new GroovyBot();
//bot.setVerbose(true);
// Connect to the IRC server.
bot.connect("irc.freenode.net");
// Join the channels.
bot.joinChannel("#emacs");
}
}
GroovyBot.startBot();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.