diff options
author | shillingp <p.shilling.ps@gmail.com> | 2014-12-19 23:28:33 +0000 |
---|---|---|
committer | shillingp <p.shilling.ps@gmail.com> | 2014-12-19 23:28:33 +0000 |
commit | 74dfdb580d6a901924694dafec8fe976dc944a71 (patch) | |
tree | 721117916e57977073caa96917c27d42bb61cf73 /damnspam.py | |
parent | 74121f139cd9bd3c9147ac447d62427522e17738 (diff) |
Added support for damnspam -1 time arguments
Diffstat (limited to 'damnspam.py')
-rw-r--r-- | damnspam.py | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/damnspam.py b/damnspam.py index e4d7a61..e74702d 100644 --- a/damnspam.py +++ b/damnspam.py @@ -43,8 +43,10 @@ def on_dammnspam_command(sender, args): try: timeout_on = round(float(timeout_on), 2) timeout_off = timeout_on - if not 0 <= timeout_on <= 60: - msg(sender, "&cThe timeout must be within 0-60.") + if 60 >= timeout_on <= -2 or timeout_on == 0: + timeout_on = False + if timeout_on == False: + msg(sender, "&cThe timeout must be within 0-60 or -1.") return True except ValueError: msg(sender, "&cThe timeout must be a number") @@ -57,8 +59,12 @@ def on_dammnspam_command(sender, args): try: timeout_on = round(float(timeout_on), 2) timeout_off = round(float(timeout_off), 2) - if not 0 <= timeout_on <= 60 or not 0 <= timeout_off <= 60: - msg(sender, "&cThe timeout must be within 0-60.") + if 60 >= timeout_on <= -2 or timeout_on == 0: + timeout_on = False + if 60 >= timeout_off <= -2 or timeout_off == 0: + timeout_off = False + if timeout_on == False or timeout_off == False: + msg(sender, "&cThe timeout must be within 0-60 or -1.") return True except ValueError: msg(sender, "&cThe timeout must be a number") @@ -137,9 +143,13 @@ def on_interact(event): data = inputs.get(pos_str) if data: checktime = data["timeout_on"] if powered else data["timeout_off"] - if data["last_time"] + checktime > now(): + if checktime == -1: + event.setCancelled(True) + plugin_header(sender, "DamnSpam") + msg(sender, "&cThis %s is locked permanently." % (btype)) + elif data["last_time"] + checktime > now(): event.setCancelled(True) plugin_header(sender, "DamnSpam") msg(sender, "&cThis %s has a timeout of %ss." % (btype, checktime)) else: - inputs[pos_str]["last_time"] = round(now(), 2)
\ No newline at end of file + inputs[pos_str]["last_time"] = round(now(), 2) |