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

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

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

      1. <i id='wBbuB'><tr id='wBbuB'><dt id='wBbuB'><q id='wBbuB'><span id='wBbuB'><b id='wBbuB'><form id='wBbuB'><ins id='wBbuB'></ins><ul id='wBbuB'></ul><sub id='wBbuB'></sub></form><legend id='wBbuB'></legend><bdo id='wBbuB'><pre id='wBbuB'><center id='wBbuB'></center></pre></bdo></b><th id='wBbuB'></th></span></q></dt></tr></i><div id='wBbuB'><tfoot id='wBbuB'></tfoot><dl id='wBbuB'><fieldset id='wBbuB'></fieldset></dl></div>
      2. 使用 Discord.py 在一条消息中发送多个嵌入

        时间:2023-10-11
      3. <legend id='ywlo9'><style id='ywlo9'><dir id='ywlo9'><q id='ywlo9'></q></dir></style></legend>

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

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

                    <tbody id='ywlo9'></tbody>

                  本文介绍了使用 Discord.py 在一条消息中发送多个嵌入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我一直在尝试使用 discord.py 在单个消息中发送嵌入列表.

                  I've been trying to send a list of embeds in a single message using discord.py.

                  我在 discord.py 的文档中看到它是可能的:https://discordpy.readthedocs.io/en/latest/api.html

                  I've seen it was possible in discord.py's documentation: https://discordpy.readthedocs.io/en/latest/api.html

                  send(content=None, *, wait=False, username=None, avatar_url=None, tts=False, file=None, files=None, embed=None, embeds=None)

                  send(content=None, *, wait=False, username=None, avatar_url=None, tts=False, file=None, files=None, embed=None, embeds=None)

                  embeds (List[Embed]) – 与内容一起发送的嵌入列表.最多 10 个.这不能与 embed 参数混合.

                  embeds (List[Embed]) – A list of embeds to send with the content. Maximum of 10. This cannot be mixed with the embed parameter.

                  但是,当我尝试通过嵌入"时收到一条错误消息.send() 函数的参数:

                  However, I get an error message when I try to pass the "embeds" parameter to the send() function:

                  TypeError: send() 得到了一个意外的关键字参数 'embeds'

                  TypeError: send() got an unexpected keyword argument 'embeds'

                  我需要有几个嵌入,因为我想使用作者字段的图标功能,并且我需要它们在同一条消息中,因为如果用户添加反应,我想用嵌入上的另一个列表替换这些嵌入.

                  I need to have several embeds because I'd like to use the author field's icon feature, and I need them in the same message because I want to replace these embeds by another list on embeds if the user adds a reaction.

                  这是我的代码:

                  embedList = []
                  for monster in monsters:
                      embed = discord.Embed(color= 0x202225)
                      embed.set_author(name=monster['name'], icon_url="https://ochabot.co/sprites/16/" + str(monster["family"]) + "_" + str(monster["species"]) + "_discord.png")
                      embedList.append(embed)
                      if(len(embedList) == 10):
                          print(embedList)
                          await message.channel.send(embeds=embedList)
                          embedList = []
                  

                  这应该每十个怪物发送一条包含 10 个嵌入的消息.

                  This is supposed to send a single message containing 10 embeds every ten monsters.

                  我是 Python 新手,所以我可能只是犯了一个愚蠢的错误.感谢您的帮助!

                  I'm new to Python so I might have just made a stupid mistake. Thank you for your help!

                  这是print(embedList)"的内容.显示:

                  EDIT : Here is what "print(embedList)" displays :

                  [<discord.embeds.Embed object at 0x7fd3552d9dc8>, <discord.embeds.Embed object at 0x7fd3552d9e58>, <discord.embeds.Embed object at 0x7fd3552d9ee8>, <discord.embeds.Embed object at 0x7fd3552d9f78>, <discord.embeds.Embed object at 0x7fd354274048>, <discord.embeds.Embed object at 0x7fd3542740d8>, <discord.embeds.Embed object at 0x7fd354274168>, <discord.embeds.Embed object at 0x7fd3542741f8>, <discord.embeds.Embed object at 0x7fd354274288>, <discord.embeds.Embed object at 0x7fd354274318>]
                  

                  推荐答案

                  这个答案只是为了完成:Discord Bot API 不允许在一条消息中发送多个嵌入.正如 在这里看到的 (并且已经在评论中提到由明)

                  This answer is only for the sake of completion: The Discord Bot API allows for no way of sending multiple embeds in one message. As seen here (and already mentioned in the comments by Minn)

                  embed (Embed) – 内容的丰富嵌入.

                  意味着该函数只接受一个嵌入对象,而不是它们的列表.

                  Meaning the function only accepts an embed object, not a list of them.

                  这篇关于使用 Discord.py 在一条消息中发送多个嵌入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Discord.py-Rewrite 获取列入黑名单的术语列表并检查 下一篇:如何在 discord.py rewrite 中获取成员数?

                  相关文章

                  最新文章

                  • <bdo id='9AJWS'></bdo><ul id='9AJWS'></ul>

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

                      <small id='9AJWS'></small><noframes id='9AJWS'>

                    1. <tfoot id='9AJWS'></tfoot>