store module.do instead of module, making this an awful lot like
an internal command bus. steal a trick from irclib and sort based
on priority, while we're at it. we added priority a while ago, and
this means that low prio (high value) items are called later, meaning
we can do things like
!join #botname
and have the IrcAdmin handler handle it before MegaHAL gets to it
we do this deep in the server in order to have the split functionality
use it properly. i still don't know if it handles server privacy
masks properly (which would only be noticed if that cloak is sent
when you connect).
actually, on that note, this only works if the ircd sends the
nickmask in 001. but hey, it works on one server at least
with alias calling do() internally, there is no need for all this
replypath nonsense, and if there's ever a module that needs to reply
to stuff on its own outside of do(), it'd have to be implementing
all of this anyway, so it was pretty irrelevant.
this makes DrBotIRC alias/recursion stuff a bit cleaner.
this is possible because now the alias stuff in DrBotIRC calls
each module's do() on a pubmsg/privmsg.
this also gets rid of all the meta options (so remove them from
your config file!), and IrcAdmin now only needs to connect
to welcome.
okay, it's time. we got around for a while with all sorts of silly
config options and exceptions and common strings triggering bot
commands. but now it's time to man up and expect modules to be
more strict and less loosey-goosey.
convert the popular modules (i.e. the ones that still work) to
trigger on !pi rather than pi, etc. usually, this is achieved via
regex searches, although there are some weird bugs (ones i'm hoping
are caused by other recursion/alias bugs and not this commit).
more code around this will be gutted soon, but this, at least,
means you can't say 'tweet that shit, yo' and accidentally trigger
the bot.
this is a big change. DrBotIrc is now in charge of module loading
and unloading, aliases, and recursion. the Alias module is no more,
and a bunch of functionality was moved out of IrcAdmin, including
also config file saving, the sigint handler, and quitting the bot.
additionally, a lot of stuff got caught in the wake. dr.botzo.py
is simpler now, and lets DrBotIRC do the dynamic loading stuff.
Module.__init__ changed, modules no longer get modlist and instead
get a reference to the DrBotIRC object. IrcAdmin still has the same
exposed methods, but now calls out to DrBotIRC to achieve some of
them.
naturally, a recursion/alias rewrite was included with this change.
it is clearer now (i think), but probably brittle somewhere.
additionally, currently any module that has registered a pubmsg
handler can potentially fire more than once on one input (without
recursion). this may be the next thing to fix. do() may need to
be split, or maybe it's time to stop having modules deal with
pubmsg/privmsg entirely. need to decide.
WEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
unicode-escape appears to do bad things to hiragana and probably
all unicode characters that are not unicode escaped. ultimately
it seems that google's responses are not consistent.
back to the drawing board.
This reverts commit 40888869b0.
this works via Module.reply(). if it produces IRC output, it returns
"NO MORE", which is returned by do(), which is returned by the handler,
which instructs irclib to cease calling handlers. now all we need
is some priorities for the modules (also supported by irclib) and
we may be in business
IrcAdmin:
* have sub_unload_module() call the module's shutdown() before deleting stuff
* sub_unload_module() needs to delete the sys.modules entry too
* slightly more verbose output in sub_unload_module()
* sub_reload_module() now does a self.sub_unload_module() + self.sub_load_module()
Module:
* remove reload() --- modules must now safely handle shutdown