1. <legend id='bSZ46'><style id='bSZ46'><dir id='bSZ46'><q id='bSZ46'></q></dir></style></legend>
  2. <tfoot id='bSZ46'></tfoot>
      • <bdo id='bSZ46'></bdo><ul id='bSZ46'></ul>
    1. <small id='bSZ46'></small><noframes id='bSZ46'>

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

      AttributeError:“Bot"对象没有属性“add_roles&quo

      时间:2023-09-09
    2. <legend id='Zghj9'><style id='Zghj9'><dir id='Zghj9'><q id='Zghj9'></q></dir></style></legend>

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

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

              1. 本文介绍了AttributeError:“Bot"对象没有属性“add_roles"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我正在用 Python 编写一个不和谐的机器人.我希望当有人登录到服务器时,他被赋予了特定的角色

                I am writing a bot for discord in Python. I want that when someone logged in to the server, he was given a certain role

                import discord
                from discord.ext import commands
                from discord.ext.commands import bot
                bot = commands.Bot(command_prefix='!')
                from discord.utils import get
                
                @bot.event
                async def on_member_join(member):
                    role = get(member.roles, name="Игроки")
                    await bot.add_roles(member, role)
                

                当我启动并且有人进入服务器时,我收到以下错误:AttributeError:Bot"对象没有属性add_roles"

                When I start and someone enters the server, I get the following error: AttributeError: 'Bot' object has no attribute 'add_roles'

                推荐答案

                确保您使用的是 最新版本的文档.您应该从公会获得角色并使用 Member.add_roles

                Make sure you're using the latest version of the documentation. You should be getting the role from the guild and using Member.add_roles

                @bot.event
                async def on_member_join(member):
                    role = get(member.guild.roles, name="Игроки")
                    await member.add_roles(role)
                

                这篇关于AttributeError:“Bot"对象没有属性“add_roles"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:我将如何为我的不和谐机器人令牌创建一个 .en 下一篇:不和谐机器人可以存储信息的地方在哪里[discor

                相关文章

                最新文章

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

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

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