close

How can I send an embed via my Discord bot, w/python?

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How can I send an embed via my Discord bot, w/python in Python. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

Table of Contents

How can I send an embed via my Discord bot, w/python?

  1. How can I send an embed via my Discord bot, w/python?

    When executing this code, I get the error that 'Embed' is not a valid member of the module 'discord'. All websites, show me this code, and I have no idea of any other way to send a embed.

  2. send an embed via my Discord bot, w/python

    When executing this code, I get the error that 'Embed' is not a valid member of the module 'discord'. All websites, show me this code, and I have no idea of any other way to send a embed.

Method 1

To get it to work I changed your send_message line to await message.channel.send(embed=embed)

Here is a full example bit of code to show how it all fits:

@client.event
async def on_message(message):
    if message.content.startswith('!hello'):
        embedVar = discord.Embed(title="Title", description="Desc", color=0x00ff00)
        embedVar.add_field(name="Field1", value="hi", inline=False)
        embedVar.add_field(name="Field2", value="hi2", inline=False)
        await message.channel.send(embed=embedVar)

Method 2

When executing this code, I get the error that ‘Embed’ is not a valid member of the module ‘discord’. All websites, show me this code, and I have no idea of any other way to send a embed.

This means you’re out of date. Use pip to update your version of the library.

pip install --upgrade discord.py

Summery

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

Also, Read