Use check_once instead of before_invoke
All checks were successful
Build and Publish Jimmy.2 / build_and_publish (push) Successful in 7s
All checks were successful
Build and Publish Jimmy.2 / build_and_publish (push) Successful in 7s
This commit is contained in:
parent
090e3f9a74
commit
61d6f0423e
1 changed files with 3 additions and 1 deletions
|
@ -204,7 +204,7 @@ async def check_is_enabled(ctx: commands.Context | discord.ApplicationContext) -
|
|||
return True
|
||||
|
||||
|
||||
@bot.before_invoke
|
||||
@bot.check_once
|
||||
async def add_delays(ctx: commands.Context | discord.ApplicationContext) -> bool:
|
||||
blocked = CONFIG["jimmy"].get("delay", {})
|
||||
if ctx.author.id in blocked:
|
||||
|
@ -215,6 +215,8 @@ async def add_delays(ctx: commands.Context | discord.ApplicationContext) -> bool
|
|||
log.warning("Delaying user %s by %.2f seconds.", ctx.author, n)
|
||||
await asyncio.sleep(n)
|
||||
log.info("Artificial delay for %s lifted", ctx.author)
|
||||
else:
|
||||
log.debug("%s is not in %s", ctx.author.id, blocked.keys())
|
||||
return True
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue