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:
| @help | prints out the public commands the bot responds to |
| @8ball question | random 8ball response |
| @spin | point to one of the 10 most recently active users |
| @addquote user quote | store a particularly memorable quote from the specified user |
| @quotelist | list all users that have a quote stored |
| @quote | prints a random quote |
| @quote user | prints a random quote from the user |
| @seen user | prints 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
| save | immediately save quote and seen data |
| print all stored quotes | |
| print user | print all stored quotes from the user |
| delquotes password user | delete all quotes from the user |
| delquotes password user index | delete the specified quote from the user |
| seenlist user | print the 10 most recently active users |
| @quote | similar to public command, but the bot responds privately |
| @quote user | similar to public command, but the bot responds privately |
The bot takes four arguments:
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.
View the source
MyBot.java - this is 90% of the code.