<tfoot id='7k9F6'></tfoot>

      <small id='7k9F6'></small><noframes id='7k9F6'>

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

        • <bdo id='7k9F6'></bdo><ul id='7k9F6'></ul>
      1. discord.py 循环导入(AttributeError:部分初始化模块&

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

        <small id='62yM7'></small><noframes id='62yM7'>

        <tfoot id='62yM7'></tfoot>
            <bdo id='62yM7'></bdo><ul id='62yM7'></ul>
            • <i id='62yM7'><tr id='62yM7'><dt id='62yM7'><q id='62yM7'><span id='62yM7'><b id='62yM7'><form id='62yM7'><ins id='62yM7'></ins><ul id='62yM7'></ul><sub id='62yM7'></sub></form><legend id='62yM7'></legend><bdo id='62yM7'><pre id='62yM7'><center id='62yM7'></center></pre></bdo></b><th id='62yM7'></th></span></q></dt></tr></i><div id='62yM7'><tfoot id='62yM7'></tfoot><dl id='62yM7'><fieldset id='62yM7'></fieldset></dl></div>
                  本文介绍了discord.py 循环导入(AttributeError:部分初始化模块'discord')的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试编写一个 Discord 机器人,但该机器人无法启动并引发此错误:

                  I am trying to write a Discord bot, but the bot won't start and raises this error:

                  AttributeError: partially initialized module 'discord' has no attribute 'Client' (most likely due to a circular import)
                  

                  推荐答案

                  你的标题(在你有任何函数或方法调用之前)应该包括以下项目:

                  Your header (before you have any functions or method calls) should include the following items:

                  import discord
                  from discord.ext import commands
                  

                  您还需要初始化您的 discord 客户端.在这种情况下,客户端代表您的脚本与不和谐服务器的连接.如果你不初始化,你的命令都不会起作用.

                  You also need to initialize your discord client. In this case, a client represents your script's connection to the discord server. If you don't initialize, none of your commands will work.

                  client = commands.Bot(command_prefix=".")
                  

                  在括号内,您可以声明命令的前缀.例如,.help 与 !help.

                  within the parenthesis, you can declare the prefix for your commands. Ex, .help vs !help.

                  最后,您需要将客户端连接到服务器并在连续事件循环中运行它.这应该在文件的末尾.

                  Lastly, you need to connect your client to the server and run it in a continuous event loop. This should be at the end of your file.

                  client.run('your bot's token')
                  

                  这篇关于discord.py 循环导入(AttributeError:部分初始化模块'discord')的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何只允许管理员执行命令 下一篇:使用 discord.py 访问命令之间的变量

                  相关文章

                  最新文章

                    <bdo id='5Z4Yw'></bdo><ul id='5Z4Yw'></ul>

                    <small id='5Z4Yw'></small><noframes id='5Z4Yw'>

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

                    <legend id='5Z4Yw'><style id='5Z4Yw'><dir id='5Z4Yw'><q id='5Z4Yw'></q></dir></style></legend>
                      <tfoot id='5Z4Yw'></tfoot>