def check_cooldowns(self, userid, action, settings):
path = settings["Config"][action]
if abs(settings["Players"][userid][action] - int(time.perf_counter())) >= path:
settings["Players"][userid][action] = int(time.perf_counter())
dataIO.save_json(self.file_path, self.system)
return True
elif settings["Players"][userid][action] == 0:
settings["Players"][userid][action] = int(time.perf_counter())
dataIO.save_json(self.file_path, self.system)
return True
else:
s = abs(settings["Players"][userid][action] - int(time.perf_counter()))
seconds = abs(s - path)
remaining = self.time_formatting(seconds)
await self.bot.say("This action has a cooldown. You still have:\n{}".format(remaining))
return False
评论列表
文章目录