mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +01:00
Added some underscore action to eval.
This commit is contained in:
parent
fd959370a1
commit
956a156b21
12
src/Owner.py
12
src/Owner.py
@ -338,6 +338,11 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if conf.allowEval:
|
if conf.allowEval:
|
||||||
|
_evalEnv = {'_': None,
|
||||||
|
'__': None,
|
||||||
|
'___': None,
|
||||||
|
}
|
||||||
|
_evalEnv.update(globals())
|
||||||
def eval(self, irc, msg, args):
|
def eval(self, irc, msg, args):
|
||||||
"""<expression>
|
"""<expression>
|
||||||
|
|
||||||
@ -348,7 +353,12 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
if conf.allowEval:
|
if conf.allowEval:
|
||||||
s = privmsgs.getArgs(args)
|
s = privmsgs.getArgs(args)
|
||||||
try:
|
try:
|
||||||
irc.reply(repr(eval(s)))
|
self._evalEnv.update(locals())
|
||||||
|
x = eval(s, self._evalEnv, self._evalEnv)
|
||||||
|
self._evalEnv['___'] = self._evalEnv['__']
|
||||||
|
self._evalEnv['__'] = self._evalEnv['_']
|
||||||
|
self._evalEnv['_'] = x
|
||||||
|
irc.reply(repr(x))
|
||||||
except SyntaxError, e:
|
except SyntaxError, e:
|
||||||
irc.reply('%s: %r' % (utils.exnToString(e), s))
|
irc.reply('%s: %r' % (utils.exnToString(e), s))
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
Loading…
Reference in New Issue
Block a user