add better user error handling #37

Merged
guus merged 1 commits from user-error-handling into master 2026-10-08 22:31:10 +02:00
+15
View File
@@ -29,6 +29,21 @@ intents.members = True
bot = commands.Bot(command_prefix=commands.when_mentioned_or('!'), description='Stroopwafel. Shitpost bot extraordinaire.', pm_help=True, intents=intents)
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.BadArgument):
await ctx.send(f"{ctx.author.mention} Onheus gebruik van het commando. Lees de docs nog eens door:")
await ctx.send_help(ctx.command)
return
if isinstance(error, commands.MissingRequiredArgument):
await ctx.send(f"{ctx.author.mention} Volgens bij ben je nog iets vergeten toe te voegen aan dit commando. Lees de docs nog eens door:")
await ctx.send_help(ctx.command)
return
if isinstance(error, commands.CommandNotFound):
await ctx.send(f"{ctx.author.mention} Vermoedelijk bedoelde je iets anders. Typ !help voor alle opties.")
return
raise error
@bot.event
async def on_ready():
await add_cogs(bot)