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

<legend id='oSBt2'><style id='oSBt2'><dir id='oSBt2'><q id='oSBt2'></q></dir></style></legend>
    <tfoot id='oSBt2'></tfoot>

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

    1. discord.py 中的 Cog 和 Extension 有什么区别?

      Whats the difference between a Cog and an Extension in discord.py?(discord.py 中的 Cog 和 Extension 有什么区别?)
    2. <small id='RThpr'></small><noframes id='RThpr'>

      • <bdo id='RThpr'></bdo><ul id='RThpr'></ul>
          <tbody id='RThpr'></tbody>

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

              <legend id='RThpr'><style id='RThpr'><dir id='RThpr'><q id='RThpr'></q></dir></style></legend>

              • 本文介绍了discord.py 中的 Cog 和 Extension 有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                在 discord.py 文档中,有扩展:https://discordpy.readthedocs.io/en/stable/ext/commands/extensions.html和齿轮:https://discordpy.readthedocs.io/en/stable/ext/commands/cogs.html有什么区别?

                In the discord.py documention, there are Extensions: https://discordpy.readthedocs.io/en/stable/ext/commands/extensions.html and Cogs: https://discordpy.readthedocs.io/en/stable/ext/commands/cogs.html what is the difference?

                推荐答案

                扩展是被加载的文件,当你调用 load_extension 时,将它们视为 discord.py 库导入的模块.导入发生后,一个 setup 函数被调用,并被传递给它被加载到的 Bot 实例......本质上是 module.setup(bot).就是这样,没有更多的扩展......通常这个设置函数调用 add_cog 将在下面描述,但是没有要求他们这样做.

                Extensions are files that are loaded, think of them as modules that the discord.py library imports when you call load_extension. After the import happens, a setup function is called, and is passed the Bot instance that it was loaded into....essentially module.setup(bot). That is it, there is no more to extensions...typically this setup function calls add_cog which will be described next, however there is no requirement that they do so.

                Cog 是从 commands.Cog 继承的类,并通过 add_cog 添加到机器人的 cog 列表中,这些类通常包含命令并充当"类别"对于这些命令.它还可以容纳诸如 on_messageon_member_join 等事件的侦听器.

                A Cog is a class that inherits from commands.Cog and is added to the bot's list of cogs through add_cog, these classes typically house commands and act as a "category" for these commands. It can also house listeners for events such as on_message or on_member_join, etc.

                TL;DR - 扩展是导入的模块,cogs 是类

                这篇关于discord.py 中的 Cog 和 Extension 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                【网站声明】本站部分内容来源于互联网,旨在帮助大家更快的解决问题,如果有图片或者内容侵犯了您的权益,请联系我们删除处理,感谢您的支持!

                相关文档推荐

                How to make a discord bot that gives roles in Python?(如何制作一个在 Python 中提供角色的不和谐机器人?)
                Discord bot isn#39;t responding to commands(Discord 机器人没有响应命令)
                Can you Get the quot;About mequot; feature on Discord bot#39;s? (Discord.py)(你能得到“关于我吗?Discord 机器人的功能?(不和谐.py))
                message.channel.id Discord PY(message.channel.id Discord PY)
                How do I host my discord.py bot on heroku?(如何在 heroku 上托管我的 discord.py 机器人?)
                discord.py - Automaticaly Change an Role Color(discord.py - 自动更改角色颜色)
                <legend id='trqiF'><style id='trqiF'><dir id='trqiF'><q id='trqiF'></q></dir></style></legend>
                  <tbody id='trqiF'></tbody>

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

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

                          <tfoot id='trqiF'></tfoot>