0
votes

I have a script that detects when a 'MissingRequiredArgument' error occurs on a command and sends a message to inform the user. It worked fine till yesterday, when this error showed up:

raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'MissingRequiredArgument' object has no attribute 'send'

I don't know what happend! Also, this is the code:

@client.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.MissingRequiredArgument):
        await ctx.send("Missing argument(s)!")
2

2 Answers

0
votes

Hope this works for you

    async def on_command_error(ctx, exception):
        error = getattr(exception, "original", exception)

        if isinstance(error, commands.MissingRequiredArgument):
            await ctx.send("Missing argument(s)!")
            return
-1
votes

Use this one instead

 #     await client.send_message(message.channel, 'Missing Arguments')      #

or try replacing: # 'send' with 'send_message' #