]>
jfr.im git - erebus.git/blob - modules/eval.py
1 # Erebus IRC bot - Author: John Runyon
2 # !EVAL and !EXEC commands
6 'author': 'John Runyon (DimeCadmium)',
7 'license': 'public domain',
14 lib
= modlib
.modlib(__name__
)
15 modstart
= lib
.modstart
22 @lib.hook('eval', lib
.MANAGER
)
23 def cmd_eval(bot
, user
, chan
, *args
):
24 try: ret
= eval(' '.join(args
))
25 except: bot
.msg(chan
, "Error (%s): %s" % (sys
.exc_info()[0], sys
.exc_info()[1]))
26 else: bot
.msg(chan
, "Done: %r" % (ret
))
29 @lib.hook('exec', lib
.MANAGER
)
30 def cmd_exec(bot
, user
, chan
, *args
):
31 try: exec ' '.join(args
)
32 except: bot
.msg(chan
, "Error: %s %s" % (sys
.exc_info()[0], sys
.exc_info()[1]))
33 else: bot
.msg(chan
, "Done.")