THEWHITEBOY503 / ConnMudaeClone

This bot is an open-source Discord card game, similar to Mudae. It allows you to draw a card every X hours (default 6), and even trade cards with your friends.
MIT License
4 stars 2 forks source link

[BUG] Unnecessary error details #15

Open THEWHITEBOY503 opened 1 year ago

THEWHITEBOY503 commented 1 year ago

Describe the bug When an error is encountered, it spits out a bunch of extra error details. For example:

Whoops, that's an error! Please share this information with my developers:
Traceback (most recent call last):
  File "/home/conner/.local/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 1350, in invoke
    await ctx.command.invoke(ctx)
  File "/home/conner/.local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 1015, in invoke
    await self.prepare(ctx)
  File "/home/conner/.local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 919, in prepare
    if not await self.can_run(ctx):
  File "/home/conner/.local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 1280, in can_run
    return await discord.utils.async_all(predicate(ctx) for predicate in predicates)
  File "/home/conner/.local/lib/python3.10/site-packages/discord/utils.py", line 698, in async_all
    for elem in gen:
  File "/home/conner/.local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 1280, in <genexpr>
    return await discord.utils.async_all(predicate(ctx) for predicate in predicates)
  File "/home/conner/.local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 2197, in predicate
    raise MissingPermissions(missing)
discord.ext.commands.errors.MissingPermissions: You are missing Administrator permission(s) to run this command.

...the only information needed in this error is discord.ext.commands.errors.MissingPermissions: You are missing Administrator permission(s) to run this command.

To Reproduce Run a command that yields an error.

Expected behavior A two line output, one line explaining the bot encountered an error, and one line with the error message.

Additional context Would also like to filter out Command not found errors.

THEWHITEBOY503 commented 1 year ago

Added some error handling tidbits, and got rid of command not found errors, but some errors still produce long outputs.