Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Discord.py Bot sends weird embed text instead of embed

@bot.event
async def on_message(message):
    embed = discord.Embed(
        title = "anything",
        description = f"كت تويت : \n {message.content} \n ||@here||"
        )

    if message.channel.id == 927235996158922802:
        channelO = await bot.fetch_channel(926945495413301290)
        await channelO.send(embed)

In this code, the bot sends me this text message <discord.embeds.Embed object at 0x0000019E83E31D80> instead of the embed. There are no errors.

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Change your last line to:

await channelO.send(embed=embed)

It’s happening because when you don’t add argument embed=, files=, etc. it automatically takes it as content= which is for text messages. So, discord.py converts your embed to string and sends it like a text message.

Check out documentation

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading