Skip to content

Commit

Permalink
[calc] Remove stupid shit
Browse files Browse the repository at this point in the history
  • Loading branch information
sfan5 committed Oct 1, 2015
1 parent ce827a3 commit 0c83b15
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions calc.py
Expand Up @@ -51,7 +51,7 @@ def c(phenny, input):
return phenny.reply("Nothing to calculate.")
q = input.group(2)
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)
o = multiprocessing.Queue()
def get_result(o, q):
Expand All @@ -61,17 +61,11 @@ def get_result(o, q):
o.put(type(e).__name__ + ": " + str(e))
proc = multiprocessing.Process(target=get_result, args=(o,q))
proc.start()
proc.join(2.0)
proc.join(3.0)
if proc.is_alive():
proc.terminate()
if 'math.pow' in q or '**' in q:
phenny.reply("Kindly go fuck yourself!")
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
proc.terminate()
log.log("action", "Calculation by %s timed out." % log.fmt_user(input), phenny)
phenny.reply("Took to long to calculate")
else:
phenny.say(o.get())

Expand Down

0 comments on commit 0c83b15

Please sign in to comment.