]>
Commit | Line | Data |
---|---|---|
e33fc813 JR |
1 | # Erebus IRC bot - Author: Erebus Team |
2 | # vim: fileencoding=utf-8 | |
3 | # This file is released into the public domain; see http://unlicense.org/ | |
4 | ||
5 | # module info | |
6 | modinfo = { | |
7 | 'author': 'Erebus Team', | |
8 | 'license': 'public domain', | |
9 | 'compatible': [0], # compatible module API versions | |
10 | 'depends': [], # other modules required to work properly? | |
11 | 'softdeps': [], # modules which are preferred but not required | |
12 | } | |
13 | ||
14 | # preamble | |
15 | import modlib | |
16 | lib = modlib.modlib(__name__) | |
17 | modstart = lib.modstart | |
18 | modstop = lib.modstop | |
19 | ||
20 | # module code | |
21 | import traceback | |
22 | ||
23 | @lib.hookexception(Exception) | |
24 | def got_exception(bot, exc, source, *args, **kwargs): | |
25 | dest = lib.parent.cfg.get('exception_hook', 'destination') | |
26 | if dest is not None: | |
27 | bot.msg(dest, '%s exception: %r %r' % (source, args, kwargs)) | |
0778c029 | 28 | for line in traceback.format_exc(limit=-lib.parent.cfg.getint('exception_hook', 'limit', 5)).split("\n"): |
e33fc813 | 29 | bot.msg(dest, (' '*4) + line) |