'discord.errors.HTTPException: 400 Bad Request (error code: 50006): Cannot send an empty message when creating embed in discord
Im trying to post an embed in the channel where I post {PREFIX} help as a help embed and here is my code
@bot.event
async def on_message(message):
if message.content == f"{PREFIX} help":
if message.author != bot.user:
return
embedVar = discord.Embed(title="BlackDC", url="https://github.com/DrkTheDon/BlackDC",description="BlackDC cmds", color=0x00ff00)
embedVar.add_field(name="Help", value="hi", inline=False)
embedVar.add_field(name="Test", value="hi2", inline=False)
await message.channel.send(embed=embedVar)
await message.channel.send(embed=embedVar)
print(f"{Fore.BLUE}{curtime} {Fore.YELLOW}[*] {Fore.LIGHTWHITE_EX}Sent {Fore.RED}Help Commands{Fore.LIGHTWHITE_EX} in {Fore.YELLOW}#{message.channel} ")
elif message.content == f"{PREFIX}":
await message.channel.send(f"{message.author.mention} This bot is under development!")
But then I get this ERROR:
Ignoring exception in on_message
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "main.py", line 91, in on_message
await message.channel.send(embed=embedVar)
File "/usr/local/lib/python3.8/dist-packages/discord/abc.py", line 1065, in send
data = await state.http.send_message(channel.id, content, tts=tts, embed=embed,
File "/usr/local/lib/python3.8/dist-packages/discord/http.py", line 254, in request
raise HTTPException(r, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50006): Cannot send an empty message
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
