IRC Bot

Here is a simple IRC bot based on the PircBot Java API available at jibble.org.

The bot currently responds to a few public commands:

@helpprints out the public commands the bot responds to
@8ball questionrandom 8ball response
@spinpoint to one of the 10 most recently active users
@addquote user quotestore a particularly memorable quote from the specified user
@quotelistlist all users that have a quote stored
@quoteprints a random quote
@quote userprints a random quote from the user
@seen userprints the last thing the user said, and how long ago that was

The bot also takes a few private commands, which are accessible via private messages sent to the bot

saveimmediately save quote and seen data
printprint all stored quotes
print userprint all stored quotes from the user
delquotes password userdelete all quotes from the user
delquotes password user indexdelete the specified quote from the user
seenlist userprint the 10 most recently active users
@quotesimilar to public command, but the bot responds privately
@quote usersimilar to public command, but the bot responds privately

The bot takes four arguments:

  1. name - what name and login the bot will use
  2. channel_password - channel password
  3. private_password - private password
  4. channel - what channel to join
On the channel I have the bot run in, there is another bot in charge of granting ops. So, channel_password is what I had configured my bot's ops password to be. If you don't need this, see the OnJoin function in MyBot.java and comment out that sendNotice where the channel_password is sent.

private_password is what the bot uses to check if it is OK to delete another user's quotes. This isn't meant to be ultra high security, just a minimal barrier to prevent anybody from easily deleting stored quotes.


Planned enhancements

Reorganize the code to read an XML settings file. The file will have config info: which commands to implement, how often to save, what channel to join, the 8ball strings to use, etc.

View the source


Hosted by www.Geocities.ws

1