Intellipaat Back

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

This is my code:

@client.command()

@client.command.has_permissions(administrator=True)

async def kick(ctx, member: discord.Member):

    await member.kick()

    await ctx.message.add_reaction(" ")

    await ctx.send(f"{member.name} has been kicked by {ctx.author.name}!")

    await log_channel.send(f"{ctx.author.name} has kicked {member.display_name}")

It is giving the following error:

Traceback (most recent call last):

  File "C:/Users/Gacha/Desktop/Python Bot/bot.py", line 56, in <module>

    @client.command.has_permissions(administrator=True)

AttributeError: 'function' object has no attribute 'has_permissions'

I don't know why it is showing this, I saw someone using this and it worked for him. ;-;

1 Answer

0 votes
by (36.8k points)

It is this:

@commands.has_permissions(administrator=True) instead of @client.command.has_permissions(administrator=True)

 Do check out Data Science with Python course which helps you understand from scratch 

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...