Answer the question
In order to leave comments, you need to log in
How to force the bot to check the personal rights of users (discord.py)?
I'm trying to get a bot to change the member limit of a voice channel, assuming the member has control of the channel
@client.command()
async def limit(ctx, arg):
channel5 = ctx.author.voice.channel
perm = channel5.permissions_for(ctx.message.author)
if perm == 'manage_channels':
await channel5.edit (user_limit = arg)
await ctx.send(f'Лимит участников изменен на {arg}')
else:
await ctx.send('У вас недостаточно прав для выполнения данной команды')
if perm == 'manage_channels':
Answer the question
In order to leave comments, you need to log in
Oh, how many wonderful discoveries the official documentation is preparing for us...
We look at GuildChannel.permissions_for() , we see
Return type: Permissions
Wraps up the Discord permission value.
The properties provided are two ways. You can set and retrieve individual bits using the properties as if they were regular bools . This allows you to edit permissions.
if perm.manage_channels:
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question