Skip to content

Instantly share code, notes, and snippets.

@base698
Created May 8, 2014 06:39
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 base698/3a6c1961f7316feed412 to your computer and use it in GitHub Desktop.
Save base698/3a6c1961f7316feed412 to your computer and use it in GitHub Desktop.
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