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

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

    1. 由于“错误请求"而未发送消息与不和谐.py

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

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

            <tfoot id='qXKci'></tfoot>

          1. <legend id='qXKci'><style id='qXKci'><dir id='qXKci'><q id='qXKci'></q></dir></style></legend>
              <bdo id='qXKci'></bdo><ul id='qXKci'></ul>

                本文介绍了由于“错误请求"而未发送消息与不和谐.py的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我正在使用 Discord.py 制作机器人,但在尝试发送带有嵌入的消息时不断收到错误消息.

                I'm making a bot with Discord.py and I keep getting an error when trying to send a message with an embed.

                这是我得到的错误:

                Traceback (most recent call last):
                  File "C:UserspcDocumentsStoragepythonNanoBotot.py", line 101, in on_message
                    await client.send_message(message.channel, embed=embed)
                  File "C:UserspcAppDataLocalProgramsPythonPython36-32libsite-packagesdiscordclient.py", line 1152, in send_message
                data = yield from self.http.send_message(channel_id, content, guild_id=guild_id, tts=tts, embed=embed)
                  File "C:UserspcAppDataLocalProgramsPythonPython36-32libsite-packagesdiscordhttp.py", line 198, in request
                raise HTTPException(r, data)
                discord.errors.HTTPException: BAD REQUEST (status code: 400)
                

                我的代码:

                embed = discord.Embed(color=target.color)
                embed.set_thumbnail(url=target.avatar_url)
                embed.set_author(name=str(target.name), url="Playing " + str(target.game))
                embed.set_footer(text="!!userinfo command")
                embed.add_field(name="Status", value=str(target.status))
                embed.add_field(name="Nickname", value=str(target.nick))
                embed.add_field(name="Account Created", value=str(target.created_at))
                embed.add_field(name="Roles", value=str(roles))
                embed.add_field(name="Joined at", value=str(target.joined_at))
                await client.send_message(message.channel, embed=embed)
                

                推荐答案

                由于你使用的是discord api,如果你看了client.send_message的描述,如果你在embed 超过 2000 chrs,discord 会引发 400 请求错误.因为 Discord 的字符数限制是 2000.

                Since you're using discord api, if you read the description of client.send_message, if you send a message in the embed is longer than 2000 chrs, discord will raise a 400 request error. For Discord's character limit is 2000.

                如您所见,它实际上并不是真正的错误,discord.errors.HTTPException: BAD REQUEST (status code: 400).这是不和谐 API 造成的自定义错误.要更正它,您可以将消息拆分为少于 2000 chrs 的嵌入,然后单独发送.需要明确的是,这不是因为服务器已关闭,而是因为服务器拒绝发送您的消息,因为它太长了.

                As you can see, it's not actually a real error, discord.errors.HTTPException: BAD REQUEST (status code: 400). It's a custom error made by discord API. To correct it, you can split the message into embeds that has less than 2000 chrs and send them separately. To be clear, this isn't because that the server is down, but because the server rejected to send your message since it's too long.

                这篇关于由于“错误请求"而未发送消息与不和谐.py的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:如何创建一个简单的机器人来自动响应包含某个 下一篇:尝试使用 Discord.py rewrite 向特定频道发送消息,但

                相关文章

                最新文章

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

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

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