Example:
import org.jibble.pircbot.PircBot;
public class OwnBot extends PircBot {
public OwnBot() {
//set bot name
this.setName("BotName");
}
public static void main(String[] args) throws Exception {
// now start the bot up
OwnBot bot = new OwnBot();
// enable debugging output
bot.setVerbose(true);
// connect to your own irc server
bot.connect("irc.domain.de", 6668);
bot.identify("botpassword");
// join the #bottest1 channel
bot.joinChannel("#bottest1");
// left the #bottest2 channel
bot.partChannel("#bottest2");
}
public void onMessage(String channel, String sender, String login,
String hostname, String message) {
if (message.equalsIgnoreCase("!time")) {
String time = new java.util.Date().toString();
sendMessage(channel, sender + ": The time is now " + time);
}
…
}
}
see http://www.jibble.org/pircbot.php
