Skip to main content

Embed

Represents a Discord embed. Embeds allow you to send rich, formatted messages with images, fields, and more.

Constructor

Embed(
    title=None,
    description=None,
    colour=None,
    color=None,
    url=None,
    timestamp=None,
    fields=None,
    author=None,
    footer=None,
    image=None,
    thumbnail=None
)
title
str
The title of the embed. Must be 256 characters or fewer.
description
str
The description of the embed. Must be 4096 characters or fewer.
colour
Colour | int
The colour code of the embed. Aliased to color as well.
url
str
The URL of the embed.
timestamp
datetime
The timestamp of the embed content. This is an aware datetime.

Attributes

title
str
The title of the embed.
description
str
The description of the embed.
colour
Colour | None
The colour code of the embed. Aliased to color as well.
url
str
The URL of the embed.
timestamp
datetime | None
The timestamp of the embed content.
Returns an EmbedFooter denoting the footer contents. If the footer is not set then None is returned.
image
EmbedMedia | None
Returns an EmbedMedia denoting the image contents. If the image is not set then None is returned.
thumbnail
EmbedMedia | None
Returns an EmbedMedia denoting the thumbnail contents. If the thumbnail is not set then None is returned.
video
EmbedMedia | None
Returns an EmbedMedia denoting the video contents. If the video is not set then None is returned.
author
EmbedAuthor | None
Returns an EmbedAuthor denoting the author contents. If the author is not set then None is returned.
fields
list[EmbedField]
Returns a list of EmbedField objects denoting the field contents.

Methods

Sets the image for the embed content. This function returns the class instance to allow for fluent-style chaining.
url
str
required
The source URL for the image. Only HTTP(S) is supported.
Returns: Embed - The embed instance for chaining.Example:
embed = discord.Embed()
embed.set_image(url="https://example.com/image.png")
Sets the thumbnail for the embed content. This function returns the class instance to allow for fluent-style chaining.
url
str
required
The source URL for the thumbnail. Only HTTP(S) is supported.
Returns: Embed - The embed instance for chaining.Example:
embed = discord.Embed()
embed.set_thumbnail(url="https://example.com/thumbnail.png")
Sets the author for the embed content. This function returns the class instance to allow for fluent-style chaining.
name
str
required
The name of the author. Must be 256 characters or fewer.
url
str
The URL for the author.
icon_url
str
The URL of the author icon. Only HTTP(S) is supported.
Returns: Embed - The embed instance for chaining.Example:
embed = discord.Embed()
embed.set_author(name="Author Name", icon_url="https://example.com/avatar.png")
Adds a field to the embed object. This function returns the class instance to allow for fluent-style chaining. There must be 25 fields or fewer.
name
str
required
The name of the field. Must be 256 characters or fewer.
value
str
required
The value of the field. Must be 1024 characters or fewer.
inline
bool
Whether the field should be displayed inline. Defaults to True.
Returns: Embed - The embed instance for chaining.Example:
embed = discord.Embed(title="Fields Example")
embed.add_field(name="Field 1", value="Value 1", inline=True)
embed.add_field(name="Field 2", value="Value 2", inline=True)
embed.add_field(name="Field 3", value="Value 3", inline=False)
Inserts a field before a specified index to the embed. This function returns the class instance to allow for fluent-style chaining.
index
int
required
The index of where to insert the field.
name
str
required
The name of the field. Must be 256 characters or fewer.
value
str
required
The value of the field. Must be 1024 characters or fewer.
inline
bool
Whether the field should be displayed inline.
Returns: Embed - The embed instance for chaining.Example:
embed.insert_field_at(0, name="First Field", value="Inserted at beginning")
Modifies a field to the embed object. The index must point to a valid pre-existing field.
index
int
required
The index of the field to modify.
name
str
required
The name of the field.
value
str
required
The value of the field.
inline
bool
Whether the field should be displayed inline.
Returns: Embed - The embed instance for chaining.Example:
embed.set_field_at(0, name="Updated Field", value="Updated value")
Removes a field at a specified index. If the index is invalid or out of bounds then the error is silently swallowed.
index
int
required
The index of the field to remove.
Example:
embed.remove_field(0)  # Remove first field
Removes all fields from this embed.Example:
embed.clear_fields()
Clears embed’s author information. This function returns the class instance to allow for fluent-style chaining.Returns: Embed - The embed instance for chaining.
Removes the embed’s image. This function returns the class instance to allow for fluent-style chaining.Returns: Embed - The embed instance for chaining.
Removes the embed’s thumbnail. This function returns the class instance to allow for fluent-style chaining.Returns: Embed - The embed instance for chaining.
Creates a shallow copy of the Embed object.Returns: Embed - The copied embed object.Example:
new_embed = embed.copy()
new_embed.title = "Different Title"
Converts this embed object into a dict.Returns: dict - A dictionary of embed keys bound to the respective value.Example:
embed_dict = embed.to_dict()
Converts a dict to an Embed provided it is in the format that Discord expects it to be in.
data
dict
required
The dictionary to convert into an embed.
Returns: Embed - The converted embed object.Example:
embed_data = {"title": "My Embed", "description": "Description"}
embed = discord.Embed.from_dict(embed_data)

Example Usage

import discord
from datetime import datetime

# Create an embed
embed = discord.Embed(
    title="Server Stats",
    description="Current server statistics",
    colour=discord.Colour.blue(),
    timestamp=datetime.utcnow()
)

# Add fields
embed.add_field(name="Members", value="1000", inline=True)
embed.add_field(name="Online", value="500", inline=True)
embed.add_field(name="Channels", value="50", inline=True)

# Set footer and author
embed.set_footer(text="Updated")
embed.set_author(name="Server Bot", icon_url="https://example.com/icon.png")
embed.set_thumbnail(url="https://example.com/server_icon.png")

# Send the embed
await channel.send(embed=embed)

Character Limits

  • Title: 256 characters
  • Description: 4096 characters
  • Field Name: 256 characters
  • Field Value: 1024 characters
  • Footer Text: 2048 characters
  • Author Name: 256 characters
  • Total Characters: 6000 characters (sum of all fields)
  • Maximum Fields: 25 fields

Build docs developers (and LLMs) love