[Calc] Fix things
parent
0ebecf3c90
commit
13b3a2ed90
4
calc.py
4
calc.py
|
@ -37,7 +37,7 @@ def eval_(node):
|
|||
elif isinstance(node, ast.BinOp): # <left> <operator> <right>
|
||||
return eval_(node.op)(eval_(node.left), eval_(node.right))
|
||||
elif isinstance(node, ast.Call): # <func> ( <args> )
|
||||
return getfunc(node.func.id)(*(eval_(e) for e in node.func.args))
|
||||
return getfunc(node.func.id)(*(eval_(e) for e in node.args))
|
||||
else:
|
||||
raise TypeError("AST node type not allowed: '" + type(node).__name__ + "'")
|
||||
|
||||
|
@ -51,7 +51,7 @@ def c(phenny, input):
|
|||
q = input.group(2).encode('utf-8')
|
||||
print("[LOG]: %s calculated '%s'" % (input.nick,q))
|
||||
try:
|
||||
phenny.say(eval_expr(q))
|
||||
phenny.say(str(eval_expr(q)))
|
||||
except Exception as e:
|
||||
phenny.say("Exception: " + str(e))
|
||||
|
||||
|
|
Loading…
Reference in New Issue