<tfoot id='uVWOF'></tfoot>

  • <i id='uVWOF'><tr id='uVWOF'><dt id='uVWOF'><q id='uVWOF'><span id='uVWOF'><b id='uVWOF'><form id='uVWOF'><ins id='uVWOF'></ins><ul id='uVWOF'></ul><sub id='uVWOF'></sub></form><legend id='uVWOF'></legend><bdo id='uVWOF'><pre id='uVWOF'><center id='uVWOF'></center></pre></bdo></b><th id='uVWOF'></th></span></q></dt></tr></i><div id='uVWOF'><tfoot id='uVWOF'></tfoot><dl id='uVWOF'><fieldset id='uVWOF'></fieldset></dl></div>
      <legend id='uVWOF'><style id='uVWOF'><dir id='uVWOF'><q id='uVWOF'></q></dir></style></legend>

        <small id='uVWOF'></small><noframes id='uVWOF'>

          <bdo id='uVWOF'></bdo><ul id='uVWOF'></ul>

        403 Forbidden(错误代码:50001):添加角色时缺少访问权

        时间:2023-10-10
          <bdo id='Uh9Qi'></bdo><ul id='Uh9Qi'></ul>
          <legend id='Uh9Qi'><style id='Uh9Qi'><dir id='Uh9Qi'><q id='Uh9Qi'></q></dir></style></legend>

          <small id='Uh9Qi'></small><noframes id='Uh9Qi'>

          <tfoot id='Uh9Qi'></tfoot>

            <tbody id='Uh9Qi'></tbody>
        • <i id='Uh9Qi'><tr id='Uh9Qi'><dt id='Uh9Qi'><q id='Uh9Qi'><span id='Uh9Qi'><b id='Uh9Qi'><form id='Uh9Qi'><ins id='Uh9Qi'></ins><ul id='Uh9Qi'></ul><sub id='Uh9Qi'></sub></form><legend id='Uh9Qi'></legend><bdo id='Uh9Qi'><pre id='Uh9Qi'><center id='Uh9Qi'></center></pre></bdo></b><th id='Uh9Qi'></th></span></q></dt></tr></i><div id='Uh9Qi'><tfoot id='Uh9Qi'></tfoot><dl id='Uh9Qi'><fieldset id='Uh9Qi'></fieldset></dl></div>

                • 本文介绍了403 Forbidden(错误代码:50001):添加角色时缺少访问权限 |不和谐.py的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试快速为人们分配不同的角色,以给用户一种他们的名字是彩虹的印象(是的,我知道它反对 TOS),并且我开始在删除他们之前向人们添加角色.但是,在添加角色时,我在这篇文章的标题中得到了错误.我对此进行了调查并尝试了很多方法来解决它.机器人的角色比分配的角色更高.这是我的代码和输出:

                  I am trying to ass different roles to people rapidly to give users the impression of their name being rainbow ( yes I know its against TOS ), and I am starting by adding roles to people before I remove them. However, when adding roles I get the error in the title of this post. I have looked into this and tried quite a few ways to fix it. The bot has a higher role than the roles being give out. Here is my code and the output:

                  import discord
                  from discord.ext import commands
                  
                  bot = commands.Bot(command_prefix="$")
                  role_name = "Rainbow Six Seige"
                  peopleWithRole = []
                  guild = discord.Guild 
                  
                  @bot.event
                  async def on_ready():
                      print("Logged in as")
                      print(bot.user.name)
                      print("------")
                      guild = bot.guilds[0]
                      colours = [discord.utils.get(guild.roles, name='red'),
                                 discord.utils.get(guild.roles, name='green'),
                                 discord.utils.get(guild.roles, name='blue')
                                 ]
                  
                      role = discord.utils.find(
                          lambda r: r.name == role_name, guild.roles)
                          
                      for user in guild.members:
                          if role in user.roles:
                              peopleWithRole.append(user)
                  
                      for color in colours:
                          for user in peopleWithRole:
                              await user.add_roles(color)
                  
                  bot.run("my token")
                  

                  输出:

                  Logged in as
                  test bot
                  ------
                  Ignoring exception in on_ready
                  Traceback (most recent call last):
                    File "C:UsersUserAppDataLocalProgramsPythonPython38-32libsite-packagesdiscordclient.py", line 312, in _run_event
                      await coro(*args, **kwargs)
                    File "C:UsersUserDesktop	est	est.py", line 29, in on_ready
                      await user.add_roles(color)
                    File "C:UsersUserAppDataLocalProgramsPythonPython38-32libsite-packagesdiscordmember.py", line 641, in add_roles
                      await req(guild_id, user_id, role.id, reason=reason)
                    File "C:UsersUserAppDataLocalProgramsPythonPython38-32libsite-packagesdiscordhttp.py", line 241, in request
                      raise Forbidden(r, data)
                  discord.errors.Forbidden: 403 Forbidden (error code: 50001): Missing Access
                  

                  推荐答案

                  确保您拥有授予机器人的角色,该角色可以访问 managing roles.此外,当您从开发门户添加机器人时,您可以为其授予权限.

                  Make sure you have a role given to the bot which has access to managing roles. Also when you add the bot from the dev portal you can give it permissions.

                  最佳做法是创建一个名为 BOT 的角色,并拥有所有权限并将其提供给您在服务器中拥有的所有机器人

                  Best practice is to make a role called BOT with all the permissions and give it to all the bots you have in the server

                  这篇关于403 Forbidden(错误代码:50001):添加角色时缺少访问权限 |不和谐.py的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:用 Python 编写 Discord 机器人 - 为什么它无法设置嵌 下一篇:Python Discord Bot - python clear_reaction() 清除所有反应

                  相关文章

                  最新文章

                  <tfoot id='CUaLs'></tfoot>
                • <i id='CUaLs'><tr id='CUaLs'><dt id='CUaLs'><q id='CUaLs'><span id='CUaLs'><b id='CUaLs'><form id='CUaLs'><ins id='CUaLs'></ins><ul id='CUaLs'></ul><sub id='CUaLs'></sub></form><legend id='CUaLs'></legend><bdo id='CUaLs'><pre id='CUaLs'><center id='CUaLs'></center></pre></bdo></b><th id='CUaLs'></th></span></q></dt></tr></i><div id='CUaLs'><tfoot id='CUaLs'></tfoot><dl id='CUaLs'><fieldset id='CUaLs'></fieldset></dl></div>

                        <bdo id='CUaLs'></bdo><ul id='CUaLs'></ul>

                    1. <legend id='CUaLs'><style id='CUaLs'><dir id='CUaLs'><q id='CUaLs'></q></dir></style></legend>
                    2. <small id='CUaLs'></small><noframes id='CUaLs'>