Reputation: 162
I'm trying to make my bot say what argument was missing in an error handler in a cog file. I looked at the API and tried but i get the error, File "/home/runner/Ultimate-Bot/cogs/Commands.py", line 35, in on_command_error missing_argument = error.missing_argument AttributeError: 'MissingRequiredArgument' object has no attribute 'missing_argument'
Here is my code that I have,
if isinstance(error, commands.MissingRequiredArgument):
missing_argument = error.missing_argument
await ctx.send(f"{ctx.author.mention}, Sorry, you forgot to type an important argument! `Missing Argument: {missing_argument}`")
NOTE: I am writing this in a cog file.
Upvotes: 0
Views: 46
Reputation: 434
You can use error.param.name
Example:
if isinstance(error, commands.MissingRequiredArgument):
await ctx.send(f"{ctx.author.mention}, Sorry, you forgot to type an important argument! `Missing Argument: {error.param.name}`")
Upvotes: 2