N
N
NCraftIngEnetTM2021-12-01 12:24:10
Python
NCraftIngEnetTM, 2021-12-01 12:24:10

An error occurred while executing the code. How to fix?

The code:

@bot.command()
@commands.is_owner()
async def leave(self, ctx, id: int):
        guild = discord.utils.get(bot.guilds, id=id)
        await guild.leave()

Error:
discord.ext.commands.errors.MissingRequiredArgument: id is a required argument that is missing.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nyxoy, 2021-12-01
@Nyxoy

Look for your error on github

S
soremix, 2021-12-09
@SoreMix

I bet that the team lies outside the class.
If so, your argument, which is id, flies into the ctx parameter, and ctx itself into self.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question