Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (18.4k points)

I am making the moderation bot for discord and want to add the kick command. I did some research on kick commands but none of them work. The error is:

discord.ext.commands.errors.CommandNotFound: Command "kick" is not found

This is the code:

@commands.command()

@commands.has_permissions(kick_members=True)

async def kick(ctx, member: discord.Member, *, reason=None):

    await client.kick(member)

    await ctx.send(f'User {member} has been kick')

1 Answer

0 votes
by (36.8k points)
edited by

There is nothing like the client.kick(member). I think you are trying to do member.kick(). Here is the example of kick command:

@client.command()

async def kick(ctx, member: discord.Member, *, reason=None):

    await member.kick(reason=reason)

    await ctx.send(f'User {member} has kicked.')

Do check out Python for Data Science Course

If you wish to learn more about Python, visit the Python tutorial and Python Certification course by Intellipaat.

Browse Categories

...