[calc] Remove stupid shit
parent
ce827a3826
commit
0c83b1513c
16
calc.py
16
calc.py
|
@ -51,7 +51,7 @@ def c(phenny, input):
|
||||||
return phenny.reply("Nothing to calculate.")
|
return phenny.reply("Nothing to calculate.")
|
||||||
q = input.group(2)
|
q = input.group(2)
|
||||||
if '__' in q:
|
if '__' in q:
|
||||||
return phenny.reply("Sorry, but no double underscores.")
|
return phenny.reply("Sorry, double underscores are not allowed.")
|
||||||
log.log("event", "%s calculated '%s'" % (log.fmt_user(input), q), phenny)
|
log.log("event", "%s calculated '%s'" % (log.fmt_user(input), q), phenny)
|
||||||
o = multiprocessing.Queue()
|
o = multiprocessing.Queue()
|
||||||
def get_result(o, q):
|
def get_result(o, q):
|
||||||
|
@ -61,17 +61,11 @@ def c(phenny, input):
|
||||||
o.put(type(e).__name__ + ": " + str(e))
|
o.put(type(e).__name__ + ": " + str(e))
|
||||||
proc = multiprocessing.Process(target=get_result, args=(o,q))
|
proc = multiprocessing.Process(target=get_result, args=(o,q))
|
||||||
proc.start()
|
proc.start()
|
||||||
proc.join(2.0)
|
proc.join(3.0)
|
||||||
if proc.is_alive():
|
if proc.is_alive():
|
||||||
proc.terminate()
|
proc.terminate()
|
||||||
if 'math.pow' in q or '**' in q:
|
log.log("action", "Calculation by %s timed out." % log.fmt_user(input), phenny)
|
||||||
phenny.reply("Kindly go fuck yourself!")
|
phenny.reply("Took to long to calculate")
|
||||||
antiabuse.ignore("*!*" + input.hostmask[input.hostmask.find("@"):])
|
|
||||||
log.log("action", "Auto-ignored %s for !c crash attempt." % log.fmt_user(input), phenny)
|
|
||||||
else:
|
|
||||||
log.log("action", "Calculation by %s timed out." % log.fmt_user(input), phenny)
|
|
||||||
phenny.reply("Took to long to calculate")
|
|
||||||
return
|
|
||||||
else:
|
else:
|
||||||
phenny.say(o.get())
|
phenny.say(o.get())
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue