this could be fun. provide an XML-RPC web service that allows for
remote access into the bot. in addition to some obvious stuff, this
includes a method that lets you execute any arbitrary module's arbitrary
method (so be careful) and retrieve the results.
as a side effect this has made it apparent that i need to clean up
some of my modules so that functionality and irc responses are decoupled.
for simplicity's sake, this was added to the extlib/irclib rather
than subclassing. because i'm lazy. anyway, check that flag instead
of doing the event._target = None hack, since that hack was breaking
Markov.
for an unrelated reason (what to learn and not learn), update Markov
also remove an unused method that was getting in my way while coding this
this should result in no chains having a null context --- if no pre-existing
context is created, one is created for the channel/nick and used. this makes,
for example, arbitrary queries "private" to that nick (again unless that has
been overridden). shouldn't affect much of anything, but adding this made
the context-less learning code obsolete, which is fine since it was never used
anyway
the bot will generate acronyms of 3-8 characters in length. it's your
job to find the "best" phrase fitting the acronym. work in progress,
but this is still playable
the module will drop your old tables if you have them, so if there's data there,
be sure to back them up and figure out some migration strategy (probably annoying
and probably having to script it).
the big change is that each line is associated to a context now, and channels
are also associated to contexts. this should allow for a better partitioning
of multiple brains, and changing which channels point to which brain.
also caught in the wake is some additional logging verbosity, and a change to
no longer lower() everything learned.
the script to dump a file into the database has also been updated with the above
changes
this only makes sense if we have a target word set, which we usually do.
start with the target word and go backwords, finding k2s that lead to it
(and that lead to that k2, and so on) until we get to the start-of-chain
value, when we know we're done working backwards. then resume the normal
appending logic
probably needs some work, probably a bit slow on huge databases. analysis
pending, but this appears to work
WARNING! if you have an existing drbotzo_modules, you MUST RECREATE IT
WITH THE PRIMARY KEY. things will be wonky without it.
easiest way is to (by hand) create drbotzo_modules_temp as shown in the code,
INSERT INTO drbotzo_modules_temp SELECT * FROM drbotzo_modules, DROP the old
table, and ALTER TABLE RENAME TO the new one.
again, if you don't do this, newer modules will do all sorts of crazy
things, namely trying to create tables that already exist (because they have
multiple, differing values in drbotzo_modules)