SOC (Son of Croc) is an IRC bot. It's being developed because the code for
Darkbot is rather unmaintainable. Don't get me wrong, Darkbot is a very clever
bot, and does what it does nicely. But it has some limitations. Notably
being able to talk only on one network and one channel.
Croc was a hack of the Darkbot code base that I did back in 2004 that allowed it to do full
MIRCStats
compatible logging. Every time I wanted to change something, I got a headache
looking at the code. Therefore Son of Croc was born.
Update: some people have cleaned up the Darkbot code base as of 2005, making it a little more readable. Perhaps they read this page? It still can only run on one network/chan, however.
Presently, SOC has most of the functionality that Darkbot has, with the exception of some of the helper commands, and the channel protection stuff. Additionally, it has a standalone console program that allows an operator (i.e., me) to take control of the bot and talk to channels as if the operator were the bot. This means that the bot is a fairly complete IRC client as well. The bot can join multiple networks and channels and log them (under different nicks and idents, if required). If you have a password, you can do some
rudimentary control by /MSGing the bot from the same network it's on, and anyone can find out the bot's status.
SOC generally hangs out on Austnet in a number of channels, but if you just want to play with him a bit, he owns a chan called (unsurprisingly) #soc.
Check back for updates, as I am continually modifying the code. And the
nicest thing is the code doesn't give me a headache when I look at it :)
Enhancement list:
Do identd handling, which is currently slowing the bot down on rejoins.
(Done 22-Jan-2005)
Respond to pings properly. (Done 23-Jan-2005)
- Do even smarter language handling. Use AIML?
Do a "what do you know about" feature that will use google's I'm feeling
lucky feature. (Done 12-Feb-2005)
- Do smarter netsplit handling to follow services around.
Do standard "seen nick" processing. (Done 19-Mar-2005)
- Multithread the code. One thread per network
, an output thread per channel, and a control thread.
Implement the well-known CTCP command responses. (Done 20-Feb-2005)
Allow the database to contain "synonyms" so words like your, you're, youre, and ur will all match (Done 07-Jul-2006)
Update 02-Oct-2008, Version X00-28
- Update the HTTP GET syntax for Google queries (bug 36).
Update 10-Oct-2007, Version X00-27
- Properly compare thread IDs with pthread_equal()
- (Re-)port to linux.
- Disable automatic responses in the channel that the console is connected to.
- Create new language replacement variable "E~", that replaces everything to
the end of the line.
Update 07-Mar-2007, Version X00-26
- Correct issue when issuing the SET RANDOM ON command where the bot failed to initialize the random timers correctly, and hence never said anything (bug 33).
- Added some calls to the debug trace routine where they were missing (no bug).
- Added some additional assertions (no bug).
- Implement nick kills (no bug).
- Prevent recursion loops while replacing variables in the database (no bug).
- Randomize shrugs from a file (no bug).
- Add net/chan/nick info to the log containing phrases that the bot "shrugged" at (no bug).
Random code trivia:
- Number of modules: 66
- Number of headers: 38
- Lines of code excluding comments: 15,675
- Number of comment lines: 3,553
- Total lines of code: 19,228
Update 26-Feb-2007, Version X00-25
- add code to prevent the bot from saying the same random thing in a channel as it did last time (no bug).
- add a thread per channel to do output buffering (no bug).
- fix a bug introduced in the release X00-24 that would cause the code to hang when a QUIT command was sent to the bot under certain circumstances (Bug 32)
Update 14-Feb-2007, Version X00-24
- periodically flush log file data to disks to allow the open log files to be read (bug 31).
- Break newbot_extern.h up into manageable bits and include them in the appropriate modules rather than including all externs in one file (no bug).
- Extract console functionality to separate standalone program. Enable the bot to listen on a socket specified by the config file for connects from that program and react to the existing command set passed from the console program (bug 13).
- Allow the operator to define a new logical (environment variable) called NEWBOT_TRACE_FILE, which, if defined, will redirect stderr to the file. The logical can be redefined, which will cause the existing trace file to close and a new one to open; or deassigned, which will cause stderr to revert back to the normal system default (no bug).
Update 19-Oct-2006, Version X00-23
- random file recursion bug (bug 27)
- help message referred to old website (bug 28)
- automagically detect the gender of a nick (bug 29)
- "seen" database contained duplicates nicks (bug 30)
- code cleanup for a number of issues including:
- removing the use of C++ keyword "bool"
- casting unused return values to void
- correcting alignment issues in "seen" database and some in-memory structures
- correct descriptor initialization with non-constant values
Update 07-Jul-2006, Version X00-22
Update 01-Jul-2006, Version X00-21
- Correct some socket options to allow much faster reconnects
- Add most of the code to allow the bot to follow services around
Update 03-Nov-2005. Version X00-20.
- Previously, the code opened and closed log files each time it had to write a
line. This was slow but safe: we knew that everything would make it to the log.
Now that the code is far more stable, this version keeps the log files open
permanently (except when it rolls them overnight).
- Additionally, this version makes the bot a little less responsive to sentences that are
talking about it, and not to it.
- And lastly, after all the console code was done, give the command line the
functionality to switch off the console so the bot can be run in batch.
Update 01-Aug-2005. Version X00-19.
This version has been out for quite a while, although I haven't managed to get
here to update the page. Plus I kept tweaking the console interface to add little
features. I finally decided that enough was enough. "Ship early, ship often" even
if it's only to yourself.
- Full screen mode with scrolling window for a selected channel and an input line
down the bottom, a la mIRC.
- Command line recall and editing.
- Very minor language tweaks.
Update 03-Apr-2005. Version X00-18.
- Channel specific random files implemented. Make the random time a config file variable.
- Lots of work with the console to make the bot a far more complete standalone IRC client.
This is all in preparation for rewriting the console using Curses.
Update 28-Mar-2005. Version X00-17.
- Nothing to see here. Move along.
Update 20-Mar-2005. Version X00-16.
- Nothing to see here. Move along.
Update 19-Mar-2005. Version X00-15.
- Do standard "seen nick" processing.
Update 27-Feb-2005. Version X00-14.
- Multithread to get a command channel that takes commands from the console.
- Allow the command console to select a channel and send privmsgs to it.
Update 21-Feb-2005. Version X00-13.
- More lenient ping timeouts.
Update 20-Feb-2005. Version X00-12.
- Fix the implementation of the CTCP ping response. The code was already there, but
now it's there in a nice modular way that will make it easy to add further CTCP
responses.
- Implement CTCP version response.
- Check for ping timeouts to declare the network connection dead.
Update 19-Feb-2005. Version X00-11.
- Output some host version info in response to the STATUS command.
- The bot is now a little more explicit about secret channels it's on in response
to the status command.
Update 12-Feb-2005. Version X00-10.
- Implemented google lookups.
Update 30-Jan-2005. Version X00-09.
- Implemented SERVER command to force the bot to switch to a server.
Update 23-Jan-2005. Version X00-08.
- Broke up the command handling into multiple modules as it was getting too large.
- Removed some debug code left over from X00-05
Update 22-Jan-2005. Version X00-07.
- Implemented fake Identd responses while the bot is connecting.
Update 19-Jan-2005. Version X00-05. The bot now supports the following commands:
Normal commands:
- HELP - Print some help text
- STATUS - Print the bot's status
- SEARCH #<chan> <keyword> - Search the database for triggers
- LOGIN <yourpassword> - Identifies you to the bot
Privileged commands (you need a password):
- JOIN #<channel> - asks the bot to join a channel
- PART #<channel> - asks the bot to part a channel
- NICK <name> - asks the bot to attempt to /NICK
- SET RANDOM #<channel> {ON|OFF} - change the random flag
- SET TALK #<channel> {ON|OFF} - change the talk flag
- RELOAD #<channel> - re-read the channel database files
- LOGOUT - remove your privilege
- QUIT - asks the bot to exit
The language processing code has been completely rewritten. It's far more clean
than the junk I originally threw together to get the bot running.