0

I'm trying to make a command where the second argument is what the bot will actually do

!haha kick, !haha ban, !haha test

so I have

bot = commands.Bot(command_prefix='!')

@bot.command()
async def haha(ctx, arg):
    channel = bot.get_channel(591059696622895117)
    try:
        if (arg == "kick"):
            #kick 
        elif (arg == "ban"):
            #ban
    except:
        await channel.send("Error processing your request!")
        pass

however I run into an error when I run !haha since it's missing arguments, what am I missing?

1 Answer 1

2

If you mean commands.errors.MissingRequiredArgument, It's a feature, not a bug. You can handle it with command_error event.

@bot.event
async def on_command_error(ctx, error):
  if isinstance(error, commands.errors.MissingRequiredArgument):
    await ctx.send("Your command isn't right!\n Read the help")
  else:
    raise error
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.