Merge pull request #267 from OpzekerIT/dev

rate limit
This commit is contained in:
Lanta 2025-10-03 09:04:43 +02:00 committed by GitHub
commit 48df01a3f6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -369,6 +369,7 @@ async def dtch_help_command(ctx):
await ctx.send(embed=embed) await ctx.send(embed=embed)
@bot.command() @bot.command()
@commands.cooldown(1, 15, commands.BucketType.user)
async def ask(ctx, *, vraag: str): async def ask(ctx, *, vraag: str):
## CLAN MEMBERS ## CLAN MEMBERS
file_path = os.path.join("..", "config", "clanmembers.json") file_path = os.path.join("..", "config", "clanmembers.json")
@ -431,5 +432,11 @@ async def ask(ctx, *, vraag: str):
await ctx.send(f"{ctx.author.mention} {antwoord[:1900]}") await ctx.send(f"{ctx.author.mention} {antwoord[:1900]}")
except Exception as e: except Exception as e:
await ctx.send(f"{ctx.author.mention} Er ging iets mis: {e}") await ctx.send(f"{ctx.author.mention} Er ging iets mis: {e}")
@ask.error
async def ask_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
retry_after = int(error.retry_after + 0.999)
await ctx.reply(f"Rustig {ctx.author.display_name}, probeer het over {retry_after}s nog eens.")
else:
raise error
bot.run(token) bot.run(token)