I'm trying to program a command that mutes every member in the author's voice channel. I'm doing this so myself and my friends can mute ourselves when we swap to in-game voice chat automatically. But for reasons I cannot explain, I can never get it to work. Here's my code:
@commands.command()
@commands.has_permissions(mute_members=True)
async def mute(self, ctx):
if ctx.author.voice and ctx.author.voice.channel:
channel = ctx.author.voice.channel
for member in channel.members:
await member.edit(mute=True)
else:
await ctx.send("You are not connected to a voice channel!")
This is the full error
I understand that the bot and the author need a mute members permission, but both of them do! I even made sure that they were at the top of the role list, and I edited the voice channel permissions to allow mute members for the author and bot. No matter what I do, I always keep getting the same error! Any help would be greatly appreciated!
MissingPermissions
is aCheckFailure
. – Patrick Haughhas_guild_permissions
instead. I suspect the channel permissions don't havemute_members
because you can't mute people in a text channel. You would have to checkchannel.permissions_for(ctx.author)
in the body of your callback. – Patrick Haugh