]>
Commit | Line | Data |
---|---|---|
d1ea05b0 JR |
1 | # preamble |
2 | import modlib | |
3 | lib = modlib.modlib(__name__) | |
4 | modstart = lib.modstart | |
5 | modstop = lib.modstop | |
6 | ||
7 | #module code | |
8 | import sys | |
9 | ||
10 | ||
11 | @lib.hook('eval') | |
12 | def cmd_eval(bot, user, chan, *args): | |
13 | try: ret = eval(' '.join(args)) | |
14 | except: bot.msg(chan, "Error (%s): %s" % (sys.exc_info()[0], sys.exc_info()[1])) | |
15 | else: bot.msg(chan, "Done: %r" % (ret)) | |
16 | ||
17 | ||
18 | @lib.hook('exec') | |
19 | def cmd_exec(bot, user, chan, *args): | |
20 | try: exec ' '.join(args) | |
21 | except: bot.msg(chan, "Error: %s %s" % (sys.exc_info()[0], sys.exc_info()[1])) | |
22 | else: bot.msg(chan, "Done.") |