forked from I2P_Developers/i2p.i2p
config file implemented (thanks oOo)
NickServ capability (thanks oOo)
This commit is contained in:
@@ -1,214 +1,348 @@
|
|||||||
/*
|
/*
|
||||||
* bogobot - A simple join/part stats logger bot for I2P IRC.
|
* bogobot - A simple join/part stats logger bot for I2P IRC.
|
||||||
*
|
*
|
||||||
* Bogobot.java
|
* Bogobot.java
|
||||||
* 2004 The I2P Project
|
* 2004 The I2P Project
|
||||||
* This code is public domain.
|
* This code is public domain.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
import org.apache.log4j.DailyRollingFileAppender;
|
|
||||||
import org.apache.log4j.Level;
|
import java.util.Timer;
|
||||||
import org.apache.log4j.Logger;
|
import java.util.TimerTask;
|
||||||
import org.apache.log4j.PatternLayout;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.jibble.pircbot.IrcException;
|
import org.apache.log4j.DailyRollingFileAppender;
|
||||||
import org.jibble.pircbot.NickAlreadyInUseException;
|
import org.apache.log4j.Level;
|
||||||
import org.jibble.pircbot.PircBot;
|
import org.apache.log4j.Logger;
|
||||||
import org.jibble.pircbot.User;
|
import org.apache.log4j.PatternLayout;
|
||||||
|
|
||||||
/**
|
import org.jibble.pircbot.IrcException;
|
||||||
* TODO 0.4 Implement java.util.Properties for configuration.
|
import org.jibble.pircbot.NickAlreadyInUseException;
|
||||||
* TODO 0.4 Add NickServ interface.
|
import org.jibble.pircbot.PircBot;
|
||||||
* TODO 0.5 Add multi-server capability.
|
import org.jibble.pircbot.User;
|
||||||
*
|
|
||||||
* @author hypercubus
|
/**
|
||||||
* @version 0.3.1
|
* TODO 0.5 Add multi-server capability.
|
||||||
*/
|
*
|
||||||
public class Bogobot extends PircBot {
|
* @author hypercubus, oOo
|
||||||
|
* @version 0.4
|
||||||
private static final String INTERVAL_DAILY = "daily";
|
*/
|
||||||
private static final String INTERVAL_MONTHLY = "monthly";
|
public class Bogobot extends PircBot {
|
||||||
private static final String INTERVAL_WEEKLY = "weekly";
|
|
||||||
|
private static final String INTERVAL_DAILY = "daily";
|
||||||
private boolean _isIntentionalDisconnect = false;
|
private static final String INTERVAL_MONTHLY = "monthly";
|
||||||
private long _lastUserlistCommandTimestamp = 0;
|
private static final String INTERVAL_WEEKLY = "weekly";
|
||||||
private Logger _logger = Logger.getLogger(Bogobot.class);
|
|
||||||
/*
|
private boolean _isIntentionalDisconnect = false;
|
||||||
* The following will soon be moved to bogo.config and loaded via
|
private long _lastUserlistCommandTimestamp = 0;
|
||||||
* java.util.Properties when I get some time.
|
private Logger _logger = Logger.getLogger(Bogobot.class);
|
||||||
*/
|
|
||||||
private String _botPrimaryNick = "somebot";
|
private int _currentAutoRoundTripTag = 0;
|
||||||
private String _botSecondaryNick = "somebot_";
|
private long _lastAutoRoundTripSentTime = 0;
|
||||||
private String _botShutdownPassword = "take off eh";
|
private Timer _tickTimer;
|
||||||
private long _commandAntiFloodInterval = 60;
|
|
||||||
private String _ircChannel = "#i2p-chat";
|
private String _configFile;
|
||||||
private String _ircServer = "irc.duck.i2p";
|
|
||||||
private int _ircServerPort = 6668;
|
private String _botPrimaryNick;
|
||||||
private boolean _isLoggerEnabled = true;
|
private String _botSecondaryNick;
|
||||||
private boolean _isUserlistCommandEnabled = true;
|
private String _botNickservPassword;
|
||||||
private String _logFilePrefix = "irc.duck.i2p.i2p-chat";
|
private String _botUsername;
|
||||||
private String _logFileRotationInterval = INTERVAL_DAILY;
|
private String _ownerPrimaryNick;
|
||||||
private String _ownerPrimaryNick = "somenick";
|
private String _ownerSecondaryNick;
|
||||||
private String _ownerSecondaryNick = "somenick_";
|
private String _botShutdownPassword;
|
||||||
private String _userlistCommandTrigger = "!who";
|
private String _ircChannel;
|
||||||
|
private String _ircServer;
|
||||||
public Bogobot() {
|
private int _ircServerPort;
|
||||||
this.setName(_botPrimaryNick);
|
private boolean _isLoggerEnabled;
|
||||||
}
|
private String _loggedHostnamePattern;
|
||||||
|
private boolean _isUserlistCommandEnabled;
|
||||||
public static void main(String[] args) {
|
private String _logFilePrefix;
|
||||||
|
private String _logFileRotationInterval;
|
||||||
Bogobot bogobot = new Bogobot();
|
private long _commandAntiFloodInterval;
|
||||||
|
private String _userlistCommandTrigger;
|
||||||
bogobot.setVerbose(true);
|
private boolean _isRoundTripDelayEnabled;
|
||||||
|
private int _roundTripDelayPeriod;
|
||||||
if (bogobot._isLoggerEnabled)
|
|
||||||
bogobot.initLogger();
|
class BogobotTickTask extends TimerTask {
|
||||||
|
private Bogobot _caller;
|
||||||
bogobot.connectToServer();
|
|
||||||
}
|
public BogobotTickTask(Bogobot caller) {
|
||||||
|
_caller = caller;
|
||||||
protected void onDisconnect() {
|
}
|
||||||
|
|
||||||
if (_isIntentionalDisconnect)
|
public void run() {
|
||||||
System.exit(0);
|
_caller.onTick();
|
||||||
|
}
|
||||||
if (_isLoggerEnabled)
|
}
|
||||||
_logger.info(System.currentTimeMillis() + " quits *** " + this.getName() + " *** (Lost connection)");
|
|
||||||
|
private void loadConfigFile(String configFileName) {
|
||||||
try {
|
|
||||||
Thread.sleep(60000);
|
_configFile = configFileName;
|
||||||
} catch (InterruptedException e) {
|
|
||||||
// No worries.
|
Properties config = new Properties();
|
||||||
}
|
FileInputStream fis = null;
|
||||||
connectToServer();
|
|
||||||
}
|
try {
|
||||||
|
fis = new FileInputStream(configFileName);
|
||||||
protected void onJoin(String channel, String sender, String login, String hostname) {
|
config.load(fis);
|
||||||
if (sender.equals(this.getName())) {
|
} catch (IOException ioe) {
|
||||||
|
System.err.println("Error loading configuration file");
|
||||||
if (_isLoggerEnabled)
|
System.exit(2);
|
||||||
_logger.info(System.currentTimeMillis() + " joins *** " + _botPrimaryNick + " ***");
|
|
||||||
|
} finally {
|
||||||
} else {
|
if (fis != null) try {
|
||||||
|
fis.close();
|
||||||
if (_isLoggerEnabled)
|
} catch (IOException ioe) { // nop
|
||||||
_logger.info(System.currentTimeMillis() + " joins " + sender);
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
}
|
_botPrimaryNick = config.getProperty("botPrimaryNick", "somebot");
|
||||||
|
_botSecondaryNick = config.getProperty("botSecondaryNick", "somebot_");
|
||||||
protected void onMessage(String channel, String sender, String login, String hostname, String message) {
|
_botNickservPassword = config.getProperty("botNickservPassword", "");
|
||||||
message = message.replaceFirst("<.+?> ", "");
|
_botUsername = config.getProperty("botUsername", "somebot");
|
||||||
if (_isUserlistCommandEnabled && message.equals(_userlistCommandTrigger)) {
|
|
||||||
|
_ownerPrimaryNick = config.getProperty("ownerPrimaryNick", "somenick");
|
||||||
if (System.currentTimeMillis() - _lastUserlistCommandTimestamp < _commandAntiFloodInterval * 1000)
|
_ownerSecondaryNick = config.getProperty("ownerSecondaryNick", "somenick_");
|
||||||
return;
|
|
||||||
|
_botShutdownPassword = config.getProperty("botShutdownPassword", "take off eh");
|
||||||
Object[] users = getUsers(_ircChannel);
|
|
||||||
String output = "Userlist for " + _ircChannel + ": ";
|
_ircChannel = config.getProperty("ircChannel", "#i2p-chat");
|
||||||
|
_ircServer = config.getProperty("ircServer", "irc.duck.i2p");
|
||||||
for (int i = 0; i < users.length; i++)
|
_ircServerPort = Integer.parseInt(config.getProperty("ircServerPort", "6668"));
|
||||||
output += "[" + ((User) users[i]).getNick() + "] ";
|
|
||||||
|
_isLoggerEnabled = Boolean.valueOf(config.getProperty("isLoggerEnabled", "true")).booleanValue();
|
||||||
sendMessage(_ircChannel, output);
|
_loggedHostnamePattern = config.getProperty("loggedHostnamePattern", "");
|
||||||
_lastUserlistCommandTimestamp = System.currentTimeMillis();
|
_logFilePrefix = config.getProperty("logFilePrefix", "irc.duck.i2p.i2p-chat");
|
||||||
}
|
_logFileRotationInterval = config.getProperty("logFileRotationInterval", INTERVAL_DAILY);
|
||||||
}
|
|
||||||
|
_isRoundTripDelayEnabled = Boolean.valueOf(config.getProperty("isRoundTripDelayEnabled", "false")).booleanValue();
|
||||||
protected void onPart(String channel, String sender, String login, String hostname) {
|
_roundTripDelayPeriod = Integer.parseInt(config.getProperty("roundTripDelayPeriod", "300"));
|
||||||
|
|
||||||
if (_isLoggerEnabled)
|
_isUserlistCommandEnabled = Boolean.valueOf(config.getProperty("isUserlistCommandEnabled", "true")).booleanValue();
|
||||||
_logger.info(System.currentTimeMillis() + " parts " + sender);
|
_userlistCommandTrigger = config.getProperty("userlistCommandTrigger", "!who");
|
||||||
|
_commandAntiFloodInterval = Long.parseLong(config.getProperty("commandAntiFloodInterval", "60"));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onPrivateMessage(String sender, String login, String hostname, String message) {
|
public Bogobot(String configFileName) {
|
||||||
/*
|
|
||||||
* Nobody else except the bot's owner can shut it down, unless of
|
loadConfigFile(configFileName);
|
||||||
* course the owner's nick isn't registered and someone's spoofing it.
|
|
||||||
*/
|
this.setName(_botPrimaryNick);
|
||||||
if ((sender.equals(_ownerPrimaryNick) || sender.equals(_ownerSecondaryNick)) && message.equals(_botShutdownPassword)) {
|
this.setLogin(_botUsername);
|
||||||
|
_tickTimer = new Timer();
|
||||||
if (_isLoggerEnabled)
|
_tickTimer.scheduleAtFixedRate(new BogobotTickTask(this), 1000, 10 * 1000);
|
||||||
_logger.info(System.currentTimeMillis() + " quits *** " + this.getName() + " ***");
|
}
|
||||||
|
|
||||||
_isIntentionalDisconnect = true;
|
public static void main(String[] args) {
|
||||||
disconnect();
|
|
||||||
}
|
Bogobot bogobot;
|
||||||
}
|
|
||||||
|
if (args.length > 1) {
|
||||||
protected void onQuit(String sourceNick, String sourceLogin, String sourceHostname, String reason) {
|
System.err.println("Too many arguments, the only allowed parameter is configuration file name");
|
||||||
|
System.exit(3);
|
||||||
if (_isLoggerEnabled)
|
}
|
||||||
_logger.info(System.currentTimeMillis() + " quits " + sourceNick + " " + reason);
|
if (args.length == 1) {
|
||||||
|
bogobot = new Bogobot(args[0]);
|
||||||
}
|
} else {
|
||||||
|
bogobot = new Bogobot("bogobot.config");
|
||||||
private void connectToServer() {
|
}
|
||||||
|
|
||||||
int loginAttempts = 0;
|
bogobot.setVerbose(true);
|
||||||
|
|
||||||
while (true) {
|
if (bogobot._isLoggerEnabled)
|
||||||
try {
|
bogobot.initLogger();
|
||||||
connect(_ircServer, _ircServerPort);
|
|
||||||
break;
|
bogobot.connectToServer();
|
||||||
} catch (NickAlreadyInUseException e) {
|
}
|
||||||
if (loginAttempts == 1) {
|
|
||||||
System.out.println("Sorry, the primary and secondary bot nicks are already taken. Exiting.");
|
protected void onTick() {
|
||||||
System.exit(1);
|
// Tick about once every ten seconds
|
||||||
}
|
|
||||||
loginAttempts++;
|
if (this.isConnected() && _isRoundTripDelayEnabled) {
|
||||||
try {
|
if( ( (System.currentTimeMillis() - _lastAutoRoundTripSentTime) >= (_roundTripDelayPeriod * 1000) ) && (this.getOutgoingQueueSize() == 0) ) {
|
||||||
Thread.sleep(5000);
|
// Connected, sending queue is empty and last RoundTrip is more then 5 minutes old -> Send a new one
|
||||||
} catch (InterruptedException e1) {
|
_currentAutoRoundTripTag ++;
|
||||||
// Hmph.
|
_lastAutoRoundTripSentTime = System.currentTimeMillis();
|
||||||
}
|
sendNotice(this.getNick(),"ROUNDTRIP " + _currentAutoRoundTripTag);
|
||||||
|
}
|
||||||
if (getName().equals(_botPrimaryNick))
|
}
|
||||||
setName(_botSecondaryNick);
|
}
|
||||||
else
|
|
||||||
setName(_botPrimaryNick);
|
protected void onDisconnect() {
|
||||||
|
|
||||||
continue;
|
if (_isIntentionalDisconnect)
|
||||||
} catch (IOException e) {
|
System.exit(0);
|
||||||
System.out.println("Error during login: ");
|
|
||||||
e.printStackTrace();
|
if (_isLoggerEnabled)
|
||||||
System.exit(1);
|
_logger.info(System.currentTimeMillis() + " quits *** " + this.getName() + " *** (Lost connection)");
|
||||||
} catch (IrcException e) {
|
|
||||||
System.out.println("Error during login: ");
|
try {
|
||||||
e.printStackTrace();
|
Thread.sleep(60000);
|
||||||
System.exit(1);
|
} catch (InterruptedException e) {
|
||||||
}
|
// No worries.
|
||||||
}
|
}
|
||||||
joinChannel(_ircChannel);
|
connectToServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initLogger() {
|
protected void onJoin(String channel, String sender, String login, String hostname) {
|
||||||
|
|
||||||
String logFilePath = "logs" + File.separator + _logFilePrefix;
|
if (_isLoggerEnabled) {
|
||||||
DailyRollingFileAppender rollingFileAppender = null;
|
if (sender.equals(this.getName())) {
|
||||||
|
|
||||||
if (!(new File("logs").exists()))
|
_logger.info(System.currentTimeMillis() + " joins *** " + _botPrimaryNick + " ***");
|
||||||
(new File("logs")).mkdirs();
|
|
||||||
|
} else {
|
||||||
try {
|
|
||||||
|
String prependedHostname = "@" + hostname;
|
||||||
if (_logFileRotationInterval.equals("monthly"))
|
if (prependedHostname.endsWith(_loggedHostnamePattern)) {
|
||||||
rollingFileAppender = new DailyRollingFileAppender(new PatternLayout("%m%n"), logFilePath, "'.'yyyy-MM'.log'");
|
_logger.info(System.currentTimeMillis() + " joins " + sender);
|
||||||
else if (_logFileRotationInterval.equals("weekly"))
|
}
|
||||||
rollingFileAppender = new DailyRollingFileAppender(new PatternLayout("%m%n"), logFilePath, "'.'yyyy-ww'.log'");
|
|
||||||
else
|
}
|
||||||
rollingFileAppender = new DailyRollingFileAppender(new PatternLayout("%m%n"), logFilePath, "'.'yyyy-MM-dd'.log'");
|
}
|
||||||
|
}
|
||||||
rollingFileAppender.setThreshold(Level.INFO);
|
|
||||||
_logger.addAppender(rollingFileAppender);
|
protected void onMessage(String channel, String sender, String login, String hostname, String message) {
|
||||||
} catch (IOException ex) {
|
message = message.replaceFirst("<.+?> ", "");
|
||||||
System.out.println("Error: Couldn't create or open an existing log file. Exiting.");
|
if (_isUserlistCommandEnabled && message.equals(_userlistCommandTrigger)) {
|
||||||
System.exit(1);
|
|
||||||
}
|
if (System.currentTimeMillis() - _lastUserlistCommandTimestamp < _commandAntiFloodInterval * 1000)
|
||||||
}
|
return;
|
||||||
}
|
|
||||||
|
Object[] users = getUsers(_ircChannel);
|
||||||
|
String output = "Userlist for " + _ircChannel + ": ";
|
||||||
|
|
||||||
|
for (int i = 0; i < users.length; i++)
|
||||||
|
output += "[" + ((User) users[i]).getNick() + "] ";
|
||||||
|
|
||||||
|
sendMessage(_ircChannel, output);
|
||||||
|
_lastUserlistCommandTimestamp = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void onPart(String channel, String sender, String login, String hostname) {
|
||||||
|
|
||||||
|
if (_isLoggerEnabled) {
|
||||||
|
if (sender.equals(this.getName())) {
|
||||||
|
_logger.info(System.currentTimeMillis() + " parts *** " + _botPrimaryNick + " ***");
|
||||||
|
} else {
|
||||||
|
String prependedHostname = "@" + hostname;
|
||||||
|
if (prependedHostname.endsWith(_loggedHostnamePattern)) {
|
||||||
|
_logger.info(System.currentTimeMillis() + " parts " + sender);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void onPrivateMessage(String sender, String login, String hostname, String message) {
|
||||||
|
/*
|
||||||
|
* Nobody else except the bot's owner can shut it down, unless of
|
||||||
|
* course the owner's nick isn't registered and someone's spoofing it.
|
||||||
|
*/
|
||||||
|
if ((sender.equals(_ownerPrimaryNick) || sender.equals(_ownerSecondaryNick)) && message.equals(_botShutdownPassword)) {
|
||||||
|
|
||||||
|
if (_isLoggerEnabled)
|
||||||
|
_logger.info(System.currentTimeMillis() + " quits *** " + this.getName() + " ***");
|
||||||
|
|
||||||
|
_isIntentionalDisconnect = true;
|
||||||
|
disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void onQuit(String sourceNick, String sourceLogin, String sourceHostname, String reason) {
|
||||||
|
String prependedHostname = "@" + sourceHostname;
|
||||||
|
|
||||||
|
if (sourceNick.equals(_botPrimaryNick))
|
||||||
|
changeNick(_botPrimaryNick);
|
||||||
|
|
||||||
|
if (_isLoggerEnabled) {
|
||||||
|
if (prependedHostname.endsWith(_loggedHostnamePattern)) {
|
||||||
|
_logger.info(System.currentTimeMillis() + " quits " + sourceNick + " " + reason);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void connectToServer() {
|
||||||
|
|
||||||
|
int loginAttempts = 0;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
try {
|
||||||
|
connect(_ircServer, _ircServerPort);
|
||||||
|
break;
|
||||||
|
} catch (NickAlreadyInUseException e) {
|
||||||
|
if (loginAttempts == 1) {
|
||||||
|
System.out.println("Sorry, the primary and secondary bot nicks are already taken. Exiting.");
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
loginAttempts++;
|
||||||
|
try {
|
||||||
|
Thread.sleep(5000);
|
||||||
|
} catch (InterruptedException e1) {
|
||||||
|
// Hmph.
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getName().equals(_botPrimaryNick))
|
||||||
|
setName(_botSecondaryNick);
|
||||||
|
else
|
||||||
|
setName(_botPrimaryNick);
|
||||||
|
|
||||||
|
continue;
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.out.println("Error during login: ");
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
} catch (IrcException e) {
|
||||||
|
System.out.println("Error during login: ");
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
joinChannel(_ircChannel);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void onNotice(String sourceNick, String sourceLogin, String sourceHostname, String target, String notice) {
|
||||||
|
|
||||||
|
if (sourceNick.equals("NickServ") && (notice.indexOf("/msg NickServ IDENTIFY") >= 0) && (_botNickservPassword != "")) {
|
||||||
|
sendRawLineViaQueue("NICKSERV IDENTIFY " + _botNickservPassword);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sourceNick.equals(getNick()) && notice.equals( "ROUNDTRIP " + _currentAutoRoundTripTag)) {
|
||||||
|
int delay = (int)((System.currentTimeMillis() - _lastAutoRoundTripSentTime) / 100);
|
||||||
|
// sendMessage(_ircChannel, "Round-trip delay = " + (delay / 10.0f) + " seconds");
|
||||||
|
if (_isLoggerEnabled)
|
||||||
|
_logger.info(System.currentTimeMillis() + " roundtrip " + delay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initLogger() {
|
||||||
|
|
||||||
|
String logFilePath = "logs" + File.separator + _logFilePrefix;
|
||||||
|
DailyRollingFileAppender rollingFileAppender = null;
|
||||||
|
|
||||||
|
if (!(new File("logs").exists()))
|
||||||
|
(new File("logs")).mkdirs();
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
if (_logFileRotationInterval.equals("monthly"))
|
||||||
|
rollingFileAppender = new DailyRollingFileAppender(new PatternLayout("%m%n"), logFilePath, "'.'yyyy-MM'.log'");
|
||||||
|
else if (_logFileRotationInterval.equals("weekly"))
|
||||||
|
rollingFileAppender = new DailyRollingFileAppender(new PatternLayout("%m%n"), logFilePath, "'.'yyyy-ww'.log'");
|
||||||
|
else
|
||||||
|
rollingFileAppender = new DailyRollingFileAppender(new PatternLayout("%m%n"), logFilePath, "'.'yyyy-MM-dd'.log'");
|
||||||
|
|
||||||
|
rollingFileAppender.setThreshold(Level.INFO);
|
||||||
|
_logger.addAppender(rollingFileAppender);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
System.out.println("Error: Couldn't create or open an existing log file. Exiting.");
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@@ -17,7 +17,7 @@ import java.util.regex.Pattern;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hypercubus
|
* @author hypercubus
|
||||||
* @version 0.3.1
|
* @version 0.4
|
||||||
*/
|
*/
|
||||||
public class Bogoparser {
|
public class Bogoparser {
|
||||||
|
|
||||||
|
101
apps/bogobot/bogobot.config
Normal file
101
apps/bogobot/bogobot.config
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
#####
|
||||||
|
# Bogobot user configuration
|
||||||
|
#####
|
||||||
|
|
||||||
|
###
|
||||||
|
# The bot's nick and backup nick. You will probably want to register these with
|
||||||
|
# the IRC server's NickServ.(a NickServ interface is forthcoming).
|
||||||
|
#
|
||||||
|
botPrimaryNick=somebot
|
||||||
|
botSecondaryNick=somebot_
|
||||||
|
|
||||||
|
###
|
||||||
|
# The bot's password required by Nickserv service's identify command.
|
||||||
|
# You have to register the nickname yourself first, the bot will not.
|
||||||
|
#
|
||||||
|
botNickservPassword=
|
||||||
|
|
||||||
|
###
|
||||||
|
# The bot's username. Appears in the whois replies
|
||||||
|
#
|
||||||
|
botUsername=somebot
|
||||||
|
|
||||||
|
#####
|
||||||
|
# The bot owner's nick and backup nick. One of these must match the owner's
|
||||||
|
# currently-used nick or else remote shutdown will not be possible. You will
|
||||||
|
# probably want to register these with the IRC server's NickServ.
|
||||||
|
#
|
||||||
|
ownerPrimaryNick=somenick
|
||||||
|
ownerSecondaryNick=somenick_
|
||||||
|
|
||||||
|
###
|
||||||
|
# The bot will disconnect and shut down when sent this password via private
|
||||||
|
# message (aka query) from either of the owner nicks specified above. DO NOT USE
|
||||||
|
# THIS DEFAULT VALUE!
|
||||||
|
#
|
||||||
|
botShutdownPassword=take off eh
|
||||||
|
|
||||||
|
###
|
||||||
|
# The server, channel, and port the bot will connect to.
|
||||||
|
#
|
||||||
|
ircChannel=#i2p-chat
|
||||||
|
ircServer=irc.duck.i2p
|
||||||
|
ircServerPort=6668
|
||||||
|
|
||||||
|
###
|
||||||
|
# Set to "true" to enable logging, else "false" (but don't use quotation marks).
|
||||||
|
#
|
||||||
|
isLoggerEnabled=true
|
||||||
|
|
||||||
|
###
|
||||||
|
# Restrict logging of joins and parts on the user hostname.
|
||||||
|
# Leave empty to log all of them
|
||||||
|
# Prepend with a @ for a perfect match
|
||||||
|
# Otherwise, specify the required end of the user hostname
|
||||||
|
#
|
||||||
|
loggedHostnamePattern=@free.duck.i2p
|
||||||
|
|
||||||
|
###
|
||||||
|
# The prefix to be used for the filenames of logs.
|
||||||
|
#
|
||||||
|
logFilePrefix=irc.duck.i2p.i2p-chat
|
||||||
|
|
||||||
|
###
|
||||||
|
# How often the logs should be rotated. Either "daily", "weekly", or "monthly"
|
||||||
|
# (but don't use quotation marks).
|
||||||
|
#
|
||||||
|
logFileRotationInterval=daily
|
||||||
|
|
||||||
|
###
|
||||||
|
# Set to "true" to enable the regular round-trip delay computation,
|
||||||
|
# else "false" (but don't use quotation marks).
|
||||||
|
#
|
||||||
|
isRoundTripDelayEnabled=false
|
||||||
|
|
||||||
|
###
|
||||||
|
# How often should the round-trip delay be recorded.
|
||||||
|
# (in seconds)
|
||||||
|
#
|
||||||
|
roundTripDelayPeriod=300
|
||||||
|
|
||||||
|
###
|
||||||
|
# Set to "true" to enable the userlist command, else "false" (but don't use
|
||||||
|
# quotation marks).
|
||||||
|
#
|
||||||
|
isUserlistCommandEnabled=true
|
||||||
|
|
||||||
|
###
|
||||||
|
# The userlist trigger command to listen for. It is a good idea to prefix
|
||||||
|
# triggers with some non-alphanumeric character in order to avoid accidental
|
||||||
|
# trigger use during normal channel conversation. In most cases you will
|
||||||
|
# probably want to choose a unique trigger here that no other bots in the
|
||||||
|
# channel will respond to.
|
||||||
|
#
|
||||||
|
userlistCommandTrigger=!who
|
||||||
|
|
||||||
|
###
|
||||||
|
# The number of seconds to rest after replying to a userlist command issued by
|
||||||
|
# a user in the channel. The bot will ignore subsequent userlist commands during
|
||||||
|
# this period. This helps prevent flooding.
|
||||||
|
#
|
||||||
|
commandAntiFloodInterval=60
|
@@ -1,57 +1,57 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<!-- ********************************************************** -->
|
<!-- ********************************************************** -->
|
||||||
<!-- bogobot - A simple join/part stats logger bot for I2P IRC. -->
|
<!-- bogobot - A simple join/part stats logger bot for I2P IRC. -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- build_eclipse.xml -->
|
<!-- build-eclipse.xml -->
|
||||||
<!-- 2004 The I2P Project -->
|
<!-- 2004 The I2P Project -->
|
||||||
<!-- This code is public domain. -->
|
<!-- This code is public domain. -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- author hypercubus -->
|
<!-- author hypercubus, oOo -->
|
||||||
<!-- version 0.3.1 -->
|
<!-- version 0.4 -->
|
||||||
<!-- ********************************************************** -->
|
<!-- ********************************************************** -->
|
||||||
|
|
||||||
<project basedir="." default="dist" name="Bogobot">
|
<project basedir="." default="dist" name="Bogobot">
|
||||||
|
|
||||||
<!-- init:
|
<!-- init:
|
||||||
Create distribution directory if missing and initialize time stamp for
|
Create distribution directory if missing and initialize time stamp for
|
||||||
archive naming -->
|
archive naming -->
|
||||||
<target name="init">
|
<target name="init">
|
||||||
<mkdir dir="dist" />
|
<mkdir dir="dist" />
|
||||||
<tstamp>
|
<tstamp>
|
||||||
<format pattern="yyyy-MM-dd" property="DSTAMP" />
|
<format pattern="yyyy-MM-dd" property="DSTAMP" />
|
||||||
</tstamp>
|
</tstamp>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- dist.bin:
|
<!-- dist.bin:
|
||||||
Create the binary distribution archive -->
|
Create the binary distribution archive -->
|
||||||
<target depends="init" description="Create the binary distribution archive" name="dist.bin">
|
<target depends="init" description="Create the binary distribution archive" name="dist.bin">
|
||||||
<zip destfile="dist/Bogobot_${DSTAMP}.zip">
|
<zip destfile="dist/Bogobot_${DSTAMP}.zip">
|
||||||
<zipfileset dir="${basedir}" includes="bogobot.bat Bogobot.class bogobot.sh Bogoparser.class LICENSE_log4j.txt LICENSE_pircbot.txt log4j-1.2.8.jar pircbot.jar" />
|
<zipfileset dir="${basedir}" includes="bogobot.bat bogobot.config Bogobot.class bogobot.sh Bogoparser.class LICENSE_log4j.txt LICENSE_pircbot.txt log4j-1.2.8.jar pircbot.jar" />
|
||||||
</zip>
|
</zip>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- dist.source:
|
<!-- dist.source:
|
||||||
Create the source distribution archive -->
|
Create the source distribution archive -->
|
||||||
<target depends="init" description="Create the source distribution archive" name="dist.source">
|
<target depends="init" description="Create the source distribution archive" name="dist.source">
|
||||||
<zip destfile="dist/Bogobot_source_${DSTAMP}.zip">
|
<zip destfile="dist/Bogobot_source_${DSTAMP}.zip">
|
||||||
<zipfileset dir="${basedir}" includes="bogobot.bat Bogobot.java bogobot.sh Bogoparser.java build.xml build_eclipse.xml LICENSE_log4j.txt LICENSE_pircbot.txt log4j-1.2.8.jar pircbot.jar" />
|
<zipfileset dir="${basedir}" includes="bogobot.bat bogobot.config Bogobot.java bogobot.sh Bogoparser.java build.xml build_eclipse.xml LICENSE_log4j.txt LICENSE_pircbot.txt log4j-1.2.8.jar pircbot.jar" />
|
||||||
</zip>
|
</zip>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- dist:
|
<!-- dist:
|
||||||
Create both the binary and source distribution archives -->
|
Create both the binary and source distribution archives -->
|
||||||
<target depends="dist.bin,dist.source" description="Create both the binary and source distribution archives" name="dist">
|
<target depends="dist.bin,dist.source" description="Create both the binary and source distribution archives" name="dist">
|
||||||
<echo message="Successfully created binary and source distribution archives in directory 'dist'." />
|
<echo message="Successfully created binary and source distribution archives in directory 'dist'." />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- clean:
|
<!-- clean:
|
||||||
Delete all class files and temporary directories -->
|
Delete all class files and temporary directories -->
|
||||||
<target description="Delete all class files and temporary directories" name="clean">
|
<target description="Delete all class files and temporary directories" name="clean">
|
||||||
<delete>
|
<delete>
|
||||||
<fileset dir="${basedir}" includes="**/*.class" />
|
<fileset dir="${basedir}" includes="**/*.class" />
|
||||||
</delete>
|
</delete>
|
||||||
<echo message="Clean successful." />
|
<echo message="Clean successful." />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
</project>
|
</project>
|
@@ -1,63 +1,63 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<!-- ********************************************************** -->
|
<!-- ********************************************************** -->
|
||||||
<!-- bogobot - A simple join/part stats logger bot for I2P IRC. -->
|
<!-- bogobot - A simple join/part stats logger bot for I2P IRC. -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- build.xml -->
|
<!-- build.xml -->
|
||||||
<!-- 2004 The I2P Project -->
|
<!-- 2004 The I2P Project -->
|
||||||
<!-- This code is public domain. -->
|
<!-- This code is public domain. -->
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- author hypercubus -->
|
<!-- author hypercubus, oOo -->
|
||||||
<!-- version 0.3.1 -->
|
<!-- version 0.4 -->
|
||||||
<!-- ********************************************************** -->
|
<!-- ********************************************************** -->
|
||||||
|
|
||||||
<project basedir="." default="compile" name="Bogobot">
|
<project basedir="." default="compile" name="Bogobot">
|
||||||
|
|
||||||
<!-- init:
|
<!-- init:
|
||||||
Create distribution directory if missing and initialize time stamp for
|
Create distribution directory if missing and initialize time stamp for
|
||||||
archive naming -->
|
archive naming -->
|
||||||
<target name="init">
|
<target name="init">
|
||||||
<mkdir dir="dist" />
|
<mkdir dir="dist" />
|
||||||
<tstamp>
|
<tstamp>
|
||||||
<format pattern="yyyy-MM-dd" property="DSTAMP" />
|
<format pattern="yyyy-MM-dd" property="DSTAMP" />
|
||||||
</tstamp>
|
</tstamp>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- compile:
|
<!-- compile:
|
||||||
Compile source code -->
|
Compile source code -->
|
||||||
<target depends="init" description="Compile source code" name="compile">
|
<target depends="init" description="Compile source code" name="compile">
|
||||||
<javac classpath="${basedir}" source="1.4" srcdir="." />
|
<javac classpath="${basedir};log4j-1.2.8.jar;pircbot.jar" source="1.4" srcdir="." />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- dist.bin:
|
<!-- dist.bin:
|
||||||
Create the binary distribution archive -->
|
Create the binary distribution archive -->
|
||||||
<target depends="init,compile" description="Create the binary distribution archive" name="dist.bin">
|
<target depends="init,compile" description="Create the binary distribution archive" name="dist.bin">
|
||||||
<zip destfile="dist/Bogobot_${DSTAMP}.zip">
|
<zip destfile="dist/Bogobot_${DSTAMP}.zip">
|
||||||
<zipfileset dir="${basedir}" includes="bogobot.bat Bogobot.class bogobot.sh Bogoparser.class LICENSE_log4j.txt LICENSE_pircbot.txt log4j-1.2.8.jar pircbot.jar" />
|
<zipfileset dir="${basedir}" includes="bogobot.bat bogobot.config Bogobot.class Bogobot$BogobotTickTask.class bogobot.sh Bogoparser.class LICENSE_log4j.txt LICENSE_pircbot.txt log4j-1.2.8.jar pircbot.jar" />
|
||||||
</zip>
|
</zip>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- dist.source:
|
<!-- dist.source:
|
||||||
Create the source distribution archive -->
|
Create the source distribution archive -->
|
||||||
<target depends="init" description="Create the source distribution archive" name="dist.source">
|
<target depends="init" description="Create the source distribution archive" name="dist.source">
|
||||||
<zip destfile="dist/Bogobot_source_${DSTAMP}.zip">
|
<zip destfile="dist/Bogobot_source_${DSTAMP}.zip">
|
||||||
<zipfileset dir="${basedir}" includes="bogobot.bat Bogobot.java bogobot.sh Bogoparser.java build.xml build_eclipse.xml LICENSE_log4j.txt LICENSE_pircbot.txt log4j-1.2.8.jar pircbot.jar" />
|
<zipfileset dir="${basedir}" includes="bogobot.bat bogobot.config Bogobot.java bogobot.sh Bogoparser.java build.xml build_eclipse.xml LICENSE_log4j.txt LICENSE_pircbot.txt log4j-1.2.8.jar pircbot.jar" />
|
||||||
</zip>
|
</zip>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- dist:
|
<!-- dist:
|
||||||
Create both the binary and source distribution archives -->
|
Create both the binary and source distribution archives -->
|
||||||
<target depends="dist.bin,dist.source" description="Create both the binary and source distribution archives" name="dist">
|
<target depends="dist.bin,dist.source" description="Create both the binary and source distribution archives" name="dist">
|
||||||
<echo message="Successfully created binary and source distribution archives in directory 'dist'." />
|
<echo message="Successfully created binary and source distribution archives in directory 'dist'." />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- clean:
|
<!-- clean:
|
||||||
Delete all class files and temporary directories -->
|
Delete all class files and temporary directories -->
|
||||||
<target description="Delete all class files and temporary directories" name="clean">
|
<target description="Delete all class files and temporary directories" name="clean">
|
||||||
<delete>
|
<delete>
|
||||||
<fileset dir="${basedir}" includes="**/*.class" />
|
<fileset dir="${basedir}" includes="**/*.class" />
|
||||||
</delete>
|
</delete>
|
||||||
<echo message="Clean successful." />
|
<echo message="Clean successful." />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
Reference in New Issue
Block a user