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

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

      • <bdo id='Bh0kW'></bdo><ul id='Bh0kW'></ul>

      <tfoot id='Bh0kW'></tfoot>

      1. 如何将 discord.py 帮助命令放入嵌入中?

        时间:2023-10-11
        <i id='HK4kC'><tr id='HK4kC'><dt id='HK4kC'><q id='HK4kC'><span id='HK4kC'><b id='HK4kC'><form id='HK4kC'><ins id='HK4kC'></ins><ul id='HK4kC'></ul><sub id='HK4kC'></sub></form><legend id='HK4kC'></legend><bdo id='HK4kC'><pre id='HK4kC'><center id='HK4kC'></center></pre></bdo></b><th id='HK4kC'></th></span></q></dt></tr></i><div id='HK4kC'><tfoot id='HK4kC'></tfoot><dl id='HK4kC'><fieldset id='HK4kC'></fieldset></dl></div>

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

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

              <legend id='HK4kC'><style id='HK4kC'><dir id='HK4kC'><q id='HK4kC'></q></dir></style></legend>
                • <tfoot id='HK4kC'></tfoot>
                  本文介绍了如何将 discord.py 帮助命令放入嵌入中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  所以,我目前有一个使用 discord.py 运行的 discord 机器人,如您所知,discord.py 带有自己的帮助命令(所以我不必自己制作).它非常有用,我将我的命令分成了 cogs/categories.它确实有助于简化,因为现在我不必编写自己的帮助命令.

                  So, I currently have a discord bot running with discord.py, and as you know, discord.py comes with its own help command (so I don't have to make my own). It's very useful, and I have my commands separated into cogs/categories. It really helps with simplicity, because now I don't have to write my own help command.

                  问题是,当我运行帮助命令时,它出现在一个巨大的代码块中,如下所示:我听到一些用户抱怨说这在视觉上并不吸引人,当我添加更多命令时,它会填满屏幕.有没有简单的方法(无需编写我自己的帮助命令)将所有这些移动到嵌入中?也许复制此帮助命令的输出,并将其移动到嵌入中?如果没有,没关系,我会编写自己的帮助命令,但我只是想寻找一种简单的方法来做到这一点,而不会弄脏我的代码.与往常一样,提前感谢您.

                  The problem is, when I run the help command, it comes to me in a giant code block, like so: I have heard some complaints from users that this isn't exactly visually appealing, and as I add more commands, it fills up the screen. Is there simple way (without writing my own help command) to move all of this onto an embed? Maybe copy the output of this help command, and move that onto an embed? If not, it's ok, I'll write my own help command, but I'm just trying to look for a simple way to do this without getting my hands dirty coding. As always, thank you in advance.

                  如果需要,这里是我的代码示例:

                  In case it is needed, here is sample from my code:

                  import discord
                  from discord.ext import commands, tasks
                  
                  TOKEN = "INSERT TOKEN HERE"
                  client = commands.Bot(command_prefix="wurf ", case_insensitive=True)
                  
                  #Utility Category
                  class Utility(commands.Cog):
                      def __init__(self, client):
                          self.client = client
                          
                      @commands.command(
                          help="Shows the ping/latency of the bot in miliseconds.",
                          brief="Shows ping."
                      )
                      async def ping(self, ctx):
                          if round(client.latency * 1000) <= 50:
                              embed=discord.Embed(title="PING", description=f":ping_pong: Pingpingpingpingping! The ping is **{round(client.latency *1000)}** milliseconds!", color=0x44ff44)
                          elif round(client.latency * 1000) <= 100:
                              embed=discord.Embed(title="PING", description=f":ping_pong: Pingpingpingpingping! The ping is **{round(client.latency *1000)}** milliseconds!", color=0xffd000)
                          elif round(client.latency * 1000) <= 200:
                              embed=discord.Embed(title="PING", description=f":ping_pong: Pingpingpingpingping! The ping is **{round(client.latency *1000)}** milliseconds!", color=0xff6600)
                          else:
                              embed=discord.Embed(title="PING", description=f":ping_pong: Pingpingpingpingping! The ping is **{round(client.latency *1000)}** milliseconds!", color=0x990000)
                          await ctx.send(embed=embed)
                  client.add_cog(Utility(client))
                  client.run(TOKEN)
                  

                  推荐答案

                  您必须使用 Bot.help_command

                  这是一个简单的嵌入实现,我继承自 MinimalHelpCommand

                  Here is a simple embed implementation I threw together inheriting from MinimalHelpCommand

                  class MyHelpCommand(commands.MinimalHelpCommand):
                      async def send_pages(self):
                          destination = self.get_destination()
                          e = discord.Embed(color=discord.Color.blurple(), description='')
                          for page in self.paginator.pages:
                              e.description += page
                          await destination.send(embed=e)
                  
                  client.help_command = MyHelpCommand()
                  

                  这篇关于如何将 discord.py 帮助命令放入嵌入中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:在单独的线程中执行 run_coroutine_threadsafe 下一篇:如何创建一个新的私人文本频道并添加 2 个人?

                  相关文章

                  最新文章

                  1. <small id='ZGN4e'></small><noframes id='ZGN4e'>

                    <legend id='ZGN4e'><style id='ZGN4e'><dir id='ZGN4e'><q id='ZGN4e'></q></dir></style></legend>
                      <bdo id='ZGN4e'></bdo><ul id='ZGN4e'></ul>

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

                    1. <tfoot id='ZGN4e'></tfoot>