Brian S. Stephan
377d2145fa
catch all exceptions around self.do, and log to console
...
as much as i find this uncouth, it is handy, and also it seems
that the megahal brain gets corrupted/unusable when an exception
isn't caught and the bot dies. this should cover most of the
cases
2010-12-24 13:16:09 -06:00
Brian S. Stephan
f590daf5cd
have all modules run a shutdown() when quitting, use it to have MegaHAL close the brain
2010-12-24 10:41:12 -06:00
Brian S. Stephan
1fe9575502
move recursion stuff out of Module.py and into modules/Alias.py
...
this comes with a recursion rewrite and simplification; it works
a bit more intuitively, now, but i still haven't figured out what
caused the bug that led me down this rabbit hole.
in any event, Alias now rules the roost when it comes to recursion,
which means it's a bit poorly named, but also means that there
won't (shouldn't) be multiple accidental runs for one output, caused
by multiple modules doing the recursion (despite only one really
having a legitimate reason to) --- a classic case of the intended
use of recursion (including the comment to only recurse when you
*know* the input is for you) being lost and forgotten with time
this also obsoletes meta.skip_recursion_scan. between this commit
and the last, people would be wise to revise their config files
2010-12-16 23:43:16 -06:00
Brian S. Stephan
d18b2e49ff
add 'meta.internal_only' option, defaulting to true
...
this allows for better control on recursion/alias type things, which
is an awful lot of what the bot does these days
2010-12-16 21:06:20 -06:00
Brian S. Stephan
0db4dbb518
duh, actually call register_handlers after doing a module reload
2010-12-15 20:55:04 -06:00
Brian S. Stephan
7a9b68f2c4
remove unnecessary method, preferring register_handlers
2010-12-15 20:53:52 -06:00
Brian S. Stephan
22615d7b9a
rewrite reload support, making it an IrcAdmin command
...
only lightly tested for the moment
2010-12-15 20:43:14 -06:00
Brian S. Stephan
914e86d567
don't try to privmsg (and then crash) if replystr is None
2010-12-08 22:18:46 -06:00
Brian S. Stephan
57b6ffa0b7
re.IGNORECASE in the regexp function compiled for sqlite
2010-11-01 22:12:14 -05:00
Brian S. Stephan
b7f2b9bd0e
use re.search() rather than re.match() in a couple places
...
(search() looks for the regex anywhere in the string whereas
match() only looks for the regex starting from the beginning)
2010-10-29 00:30:02 -05:00
Brian S. Stephan
487e997a55
define a regexp function in sqlite
2010-10-28 23:52:06 -05:00
Brian S. Stephan
1d73deda1c
sqlite related stuff as part of making sqlite the canonical backend
...
* Module.py __init__ sets up sqlite db connection by default
* Module.py __init__ calls init_db() which is empty, expects subclasses to implement as necessary
* Module.py doesn't close sqlite connection by default
Changes call for a couple updates in Karma.py, namely implementing db_init
and excepting sqlite3.Error rather than closing the connection
2010-10-27 17:59:01 -05:00
Mike Bloy
98f07105bc
karma data store moved to sqlite
2010-10-24 15:13:00 -05:00
Mike Bloy
6a67795b18
modules know how to ask for a version number from the database
2010-10-24 15:11:39 -05:00
Mike Bloy
240612fecf
database connection grabbing for Modules
2010-10-24 15:11:35 -05:00
Brian S. Stephan
2a1ef11d95
don't attempt recursion when the subcmd is, in fact, an empty string (i.e. text was '[]')
2010-10-12 11:54:43 -05:00
Brian S. Stephan
52b740a52c
split the register_handlers into a method other than the object constructor
...
the reasoning behind this is that we may want to load one object
but have it connect to multiple servers. this allows that.
2010-10-09 18:52:51 -05:00
Brian S. Stephan
a7f0070a39
module reloading appears to be broken. disabling for now.
2010-09-08 20:06:20 -05:00
Brian S. Stephan
f5caeb3833
add new meta options to remove_metaoptions()
2010-09-08 19:58:29 -05:00
Brian S. Stephan
338c1e759f
meta option 'meta.strip_bot_name_from_input' to determine just that.
2010-09-08 19:49:56 -05:00
Brian S. Stephan
fc8a61a110
meta option 'meta.pubmsg_ignore_bot_prefix' to have module not try [] recursion.
...
handy for the alias module, which will want to preserve that recursion stuff (if
it shows up) after it does its alias lookup
2010-09-08 19:38:19 -05:00
Brian S. Stephan
98c30e1714
module meta option to ignore when bot is addressed directly.
...
the motivation for this is if you have commands that have been aliased
that you do not want to fire when they normally would via 'bot: blah'
2010-09-08 19:32:06 -05:00
Brian S. Stephan
bf8fe46522
retransmit_event takes an Event and re-runs it through normal event handling.
...
i wrote this for something and then realized i didn't need it, but
it may be interesting for some reason in the future
2010-09-04 10:45:18 -05:00
Brian S. Stephan
4712e69336
refer to the actual list variable when looking up meta.pubmsg_needs_bot_prefix
2010-08-01 12:19:15 -05:00
Brian S. Stephan
e13264fc3b
add method to remove metaoptions (debug, the new 'meta.pubmsg_needs_bot_prefix') from a list. provided for convenience
2010-08-01 12:13:38 -05:00
Brian S. Stephan
1ec197be95
establish a per-module option that specifies whether or not active commands to it need to be prefixed with the bot's name. doesn't help stuff like Seen's reimplementation of on_pubmsg, since it would want to do the tracking regardless of this option. also, work around this addition in the countdown module, so it doesn't show up in lists.
2010-08-01 11:55:14 -05:00
Brian S. Stephan
4d41314195
standardize config sections to use class name. NOTE: USERS NEED TO UPDATE THEIR CONFIG
2010-08-01 11:41:26 -05:00
Brian S. Stephan
5f29d12561
minor comment update following the recent register_handlers() change
2010-07-30 18:54:57 -05:00
Brian S. Stephan
594c4d297d
remove_global_handler() for pubmsg and privmsg by default, since Module does the add_global_handler() (last commit)
2010-07-30 18:53:58 -05:00
Brian S. Stephan
eb1efa4919
add_global_handler() for pubmsg and privmsg by default, since Module defines on_pubmsg/on_privmsg anyway, and that's been the default for almost every module so far
2010-07-30 18:50:56 -05:00
Brian S. Stephan
7feb90242d
renaming 'irclib' dir to 'extlib'
2010-07-30 18:34:10 -05:00
Brian S. Stephan
262ee2e3e1
PEP 257ifying dr.botzo.py and Module.py
2010-07-30 13:34:51 -05:00
Brian S. Stephan
6e86096f2b
some comments in the module reload
2010-07-30 06:56:37 -05:00
Brian S. Stephan
ae4c1fa726
move common reply functionality into a method in Module
2010-07-30 00:34:57 -05:00
Brian S. Stephan
57090fdda4
long list of changes to allow modular Module reloads: server as module variable, class appends self to module list, unregister_handlers method which must be overridden, reload method which does the magic to create the a new object of the re-read class. drop use of the main rehash and reload_modules, and don't pass rehash around anymore. load initial objects 'the old way' again. feature modules change for compatability and implementation of all of the above changes
2010-07-29 22:36:08 -05:00
Brian S. Stephan
21963fe580
print name of module that was loaded in __init__
2010-07-29 19:50:13 -05:00
Brian S. Stephan
632f89e61c
remove a bunch of variables in Module that were added because of ??????
2010-07-29 19:45:02 -05:00
Brian S. Stephan
26d2e0c294
making imports fit my style convention, actually importing os in the module that needs it
2010-07-29 00:18:20 -05:00
Brian S. Stephan
91e535978f
comment nitpicking and restyling
2010-07-29 00:04:01 -05:00
Brian S. Stephan
48498898bf
vi modelines for split out files
2010-07-28 23:48:47 -05:00
Brian S. Stephan
b65c01fb31
GPLv3 headers on the split out files
2010-07-28 23:47:29 -05:00
kad
02df2ca783
Cleanup code
2010-07-28 13:25:49 -05:00
kad
0c17196b32
Add some modelines and fix indentation, I hope.
2010-07-28 00:11:58 -05:00
kad
ec9acdd2ee
Forgot to add files :(
2010-07-27 20:35:01 -05:00