Use check_once instead of before_invoke
All checks were successful
Build and Publish Jimmy.2 / build_and_publish (push) Successful in 7s

This commit is contained in:
Nexus 2024-05-01 01:26:03 +01:00
parent 090e3f9a74
commit 61d6f0423e
Signed by: nex
GPG key ID: 0FA334385D0B689F

View file

@ -204,7 +204,7 @@ async def check_is_enabled(ctx: commands.Context | discord.ApplicationContext) -
return True return True
@bot.before_invoke @bot.check_once
async def add_delays(ctx: commands.Context | discord.ApplicationContext) -> bool: async def add_delays(ctx: commands.Context | discord.ApplicationContext) -> bool:
blocked = CONFIG["jimmy"].get("delay", {}) blocked = CONFIG["jimmy"].get("delay", {})
if ctx.author.id in blocked: 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) log.warning("Delaying user %s by %.2f seconds.", ctx.author, n)
await asyncio.sleep(n) await asyncio.sleep(n)
log.info("Artificial delay for %s lifted", ctx.author) log.info("Artificial delay for %s lifted", ctx.author)
else:
log.debug("%s is not in %s", ctx.author.id, blocked.keys())
return True return True