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.")```