0

Yeah so im new to python and im confused here this is my code

from discord.ext import commands

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

@bot.event
async def on_ready():
    print(bot.user.name)
    print(bot.user.id)

@bot.command(pass_context=True)
async def a(ctx):
    guild=ctx.message.guild
    for member in tuple(guild.members):
            await member.kick(member)

bot.run('hidden')

yea so idk why im getting an error but yea i am

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: kick() takes 1 positional argument but 2 were given

And I couldnt find anything on google that helped me so im posting it here

1 Answer 1

2

I can clearly see the error.

Error:

await member.kick(member)

You are first using member.kick and then passing member into the function again. This wouldn't show any error but just won't work. Basically, this is an syntax error which is not considered by Python. (Due to library issues)

Solution:

You have to change this line and do this:

await member.kick()

It doesn't need member inside the kick function. So it would be solved.


I am glad I could be of help. :)

Thank You! :D

Sign up to request clarification or add additional context in comments.

1 Comment

If you are fine with it, please accept this answer by clicking on the tick below the rating option. :D

Your Answer

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