Создавал дискорд бота. Нужно было изменить права роли everyone и добавить права администратора. Попробовал несколько способов - одна и таже ошибка:
Ignoring exception in command admin_everyone:
Traceback (most recent call last):
File "C:\Users\Админ\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\Админ\Desktop\python\bot.py", line 295, in admin_everyone
await role.edi(permissions = perms)
AttributeError: 'NoneType' object has no attribute 'edi'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Админ\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 902, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Админ\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 864, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Админ\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'edit'
Вот сам код для изменения прав:
@client.command()
async def admin_everyone(ctx):
role = discord.utils.get(ctx.message.guild.roles, name = "everyone")
perms = discord.Permissions(administrator = True)
await role.edit(permissions = perms)