NetherMoon
NetherMoon

Reputation: 331

Anyone know what is wrong with this mute command for discord.py rewrite mute and unmute command

I get the error that I do not have permission to use the command. I think I did something wrong with the permissions but cannot really find a list of all the available permissions in the discord.py docs. If anyone has a link to them can they please send it.

    @commands.command()
    @commands.has_permissions(mute_members=True)
    async def mute(self, ctx, member: discord.Member, reason: str = None):
        muted = discord.utils.get(ctx.guild.roles, name="Muted")
        await member.add_roles(muted)
        await ctx.send(f"{member} has been muted.")
    
    @commands.command()
    @commands.has_permissions(mute_members=True)
    async def unmute(self, ctx, member: discord.Member, reason: str = None):
        muted = discord.utils.get(ctx.guild.roles, name="Muted")
        await member.remove_roles(muted)
        await ctx.send(f"{member} has been unmuted.")```

Upvotes: 2

Views: 235

Answers (1)

Mute_members is a permission to mute people on a voice channel. Use manage_messages instead.

Oh, and if you're curious, manage_messages is a permission which allows users to delete other people's messages. So if they can delete a message, they should be able to mute too.

Upvotes: 1

Related Questions