Owners can bypass cooldowns with non persistent toggle (#4440)

* dev bypas cooldowns

* Toggleable within dev, new attrib

* Reuqested changes

* Remake content

* Looks like `reset_cooldown()` is under Command object :)

* Remove `await`

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
Jamie
2020-12-23 19:25:32 +00:00
committed by GitHub
parent 300346dcd4
commit d01bca2314
3 changed files with 21 additions and 0 deletions

View File

@@ -292,6 +292,11 @@ def init_events(bot, cli_flags):
elif isinstance(error, commands.CheckFailure):
pass
elif isinstance(error, commands.CommandOnCooldown):
if bot._bypass_cooldowns and ctx.author.id in bot.owner_ids:
ctx.command.reset_cooldown(ctx)
new_ctx = await bot.get_context(ctx.message)
await bot.invoke(new_ctx)
return
if delay := humanize_timedelta(seconds=error.retry_after):
msg = _("This command is on cooldown. Try again in {delay}.").format(delay=delay)
else: