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