Python 如何给不和谐的bot所有者';s的权限?

Python 如何给不和谐的bot所有者';s的权限?,python,discord,discord.py,Python,Discord,Discord.py,我正在使用discord.py bot,没有问题,我的代码运行良好,但我想知道如何授予bot所有者权限,他应该删除一个授予所有高权限的角色(服务器>服务器设置>角色>角色名称中的所有权限),因此他应该删除他的角色,但他给出了以下错误: discord.errors.Forbidden:403禁止(错误代码:50013):缺少权限 @bot.command(name="godRemove") async def godremover(ctx, persona, numerogo

我正在使用discord.py bot,没有问题,我的代码运行良好,但我想知道如何授予bot所有者权限,他应该删除一个授予所有高权限的角色(服务器>服务器设置>角色>角色名称中的所有权限),因此他应该删除他的角色,但他给出了以下错误:

discord.errors.Forbidden:403禁止(错误代码:50013):缺少权限

@bot.command(name="godRemove")
async def godremover(ctx, persona, numerogod):
    channel = bot.get_channel(id=786285288469037197)
    numerogod=int(numerogod)
    if not numerogod>1:
        numerogod=1
    #hasadded=False
    #hasgod=False
    rolenumber=0
    try:
        guild=ctx.guild
        if ctx.author.name in canAddGod:
            for i in guild.members:
                if str(i)[:-5].lower().strip()==persona.lower().strip():
                    for role in i.roles:
                        #if str(role)=="God":
                            #hasgod=True
                        if representsint(str(role)):
                            rolename=str(int(str(role))-numerogod).strip().lower()
                            rolenumber=int(rolename)
                            if rolenumber>1:
                                if discord.utils.get(ctx.guild.roles, name=rolename)!=None:
                                    togiverole=discord.utils.get(guild.roles, name=rolename)
                                    await i.add_roles(togiverole)
                                    await i.remove_roles(role)
                                    #hasadded=True
                                    await channel.send(removedliteral)
                                    return
                                else:
                                    togiverole=await ctx.guild.create_role(name=str(int(str(role))+numerogod), colour=discord.Colour(0xFFFFFF))
                                    await i.add_roles(togiverole)
                                    await i.remove_roles(role)
                                    #hasadded=True
                                    await channel.send(removedliteral)
                                    return
                            elif rolenumber==0:
                                await i.remove_roles(discord.utils.get(ctx.guild.roles, name="God"))
                            else:
                                await i.remove_roles(discord.utils.get(ctx.guild.roles, name="God"))
                                await i.remove_roles(role)
    except Exception:
        traceback.print_exc()
        await channel.send(errorliteral)

代码有点混乱,但有一段时间我没有用python编写代码,所以这里有一点解释(ps,这是一件有趣的事情,我想添加到我的服务器,比如,每个人都是上帝,如果他们做了一些有趣的事,我会添加上帝,如果没有,我会删除上帝,所以如果他们没有足够的上帝(
discord.errors.Forbidden:403 Forbidden(错误代码:50013):缺少权限
表示由于bot的权限,bot无法执行某些操作。这与bot所有者是分开的,后者是另一个具有独立权限的用户

您需要授予bot权限来执行您正在执行的任何操作。这在您的服务器/公会配置中完成


如果您正在编写只有bot所有者才能执行的命令,则Discord.py中有一个名为
is_owner
的装饰程序:缺少权限表示由于bot的权限,bot无法执行某些操作。这与bot所有者(具有独立权限的另一用户)是分开的

您需要授予bot权限来执行您正在执行的任何操作。这在您的服务器/公会配置中完成


如果您正在编写只有机器人所有者才能执行的命令,那么Discord.py中有一个名为
is_owner
的装饰程序。您好!谢谢您的快速回答,也很抱歉我的回复太晚,您能为is_owner链接文档吗?谢谢!谢谢,但这对我有什么帮助吗?我已经(自己)进行了检查,然后机器人应该删除该角色,通常只有所有者才能删除,我没有找到任何搜索内容。我不了解您当时尝试执行的操作。您尝试删除的角色是什么?您可以提供代码吗?哦,当然抱歉,我将修改问题您好!谢谢您的快速回答,很抱歉我的回复太晚,您可以为我链接文档吗是所有者吗?谢谢!谢谢,但这对我有什么帮助?我已经做了检查(由我自己),机器人应该删除该角色,只有所有者才能正常删除,我没有找到任何搜索内容。我没有跟踪你当时试图做的事。你想删除什么角色?你能提供代码吗?当然抱歉,我会修改这个问题