32 lines
1013 B
Python
32 lines
1013 B
Python
from time import time
|
|
from modules.utils import jsonLoad, jsonSave, configGet
|
|
|
|
def subLimit(user):
|
|
submit = jsonLoad(configGet("submit", "locations"))
|
|
submit[str(user.id)] = time()
|
|
jsonSave(submit, configGet("submit", "locations"))
|
|
|
|
def subLimited(user):
|
|
if user.id == configGet("admin"):
|
|
return False
|
|
else:
|
|
submit = jsonLoad(configGet("submit", "locations"))
|
|
if str(user.id) in submit:
|
|
if (time() - submit[str(user.id)]) < configGet("timeout", "submission"):
|
|
return True
|
|
else:
|
|
return False
|
|
else:
|
|
return False
|
|
|
|
def subBlock(user):
|
|
blocked = jsonLoad(configGet("blocked", "locations"))
|
|
if user not in blocked:
|
|
blocked.append(user)
|
|
jsonSave(blocked, configGet("blocked", "locations"))
|
|
|
|
def subUnblock(user):
|
|
blocked = jsonLoad(configGet("blocked", "locations"))
|
|
if user in blocked:
|
|
blocked.remove(user)
|
|
jsonSave(blocked, configGet("blocked", "locations")) |