#๐Ÿ”’ HTTPException: 400 Bad Request (error code: 50006): Cannot send an empty message.

9 messages ยท Page 1 of 1 (latest)

kindred scroll
#

I'm new to python, and im encountering an error HTTPException: 400 Bad Request (error code: 50006): Cannot send an empty message. when i remove the embed, it sends without any issue. However, when I add an embed, i encounter errors. Also, when I remove the Channel ID, I'm able to use the embed. Can anyone help me with this issue?. Thanks!.

    name="vouch",
    description="Vouch for a user"
)
async def vouch(ctx: commands.Context, user: discord.Member, comment: str):
    vouch_channel_id = 1210410118278152263
    
    embed = discord.Embed(
        title="Vouch Confirmation",
        color=discord.Color.green()
    )
    embed.add_field(name="Voucher", value=ctx.author.mention, inline=False)
    embed.add_field(name="Vouched User", value=user.mention, inline=False)
    if comment:
        embed.add_field(name="Comment", value=comment, inline=False)

    vouch_channel = ctx.guild.get_channel(vouch_channel_id)
    if vouch_channel:
        if embed.to_dict().get("fields"):
            await vouch_channel.send(embed=embed)
            await ctx.respond("Vouch recorded successfully!")
        else:
            await ctx.respond("Error: Embed content is empty.")
    else:
        await ctx.respond("Error: Vouch channel not found.")```
woven geyserBOT
#

Hey @kindred scroll!

It looks like you pasted Python code without syntax highlighting.

Please use syntax highlighting to improve the legibility of your code and make it easier for us to help you.

To do this, use the following method:
```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
You can **edit your original message** to correct your code block.
woven geyserBOT
#

@kindred scroll

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

violet flicker
#

oh, actually 50035 would show up if the embed was malformed...

#

can you send the full traceback?

lavish willow
#

You're converting an embed object to a dict and then trying to send it as an embed object

woven geyserBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.