Embeds

discord_http.embeds module

class discord_http.embeds.Embed(*, title=None, description=None, colour=None, color=None, url=None, timestamp=None)

Bases: object

Represents a Discord embed.

Parameters:
colour: Colour | int | None

The colour of the embed, if any.

type: Literal['rich', 'image', 'video', 'gifv', 'article', 'link', 'poll_result']

The type of the embed. Defaults to “rich”. See EmbedTypes for all options.

footer: EmbedFooter | None

The footer of the embed, if any.

author: EmbedAuthor | None

The author of the embed, if any.

image: EmbedMedia | None

The image of the embed, if any.

thumbnail: EmbedMedia | None

The thumbnail of the embed, if any.

fields: list[EmbedField]

The fields of the embed, if any.

provider: EmbedProvider | None

The provider of the embed, only sent by Discord.

video: EmbedMedia | None

The video of the embed, only sent by Discord.

title: str | None

The title of the embed, if any.

description: str | None

The description of the embed, if any.

url: str | None

The URL of the embed, if any.

timestamp: datetime | None

The timestamp of the embed, if any.

property flags: EmbedFlags

The flags of the embed.

copy() → Self

Returns a copy of the embed.

Return type:

Self

set_colour(value) → Self

Set the colour of the embed.

Parameters:

value (Colour | int | None) – The colour to set the embed to. If None, the colour will be removed

Return type:

Self

Returns:

Returns the embed you are editing

remove_colour() → Self

Remove the colour from the embed.

Return type:

Self

Set the footer of the embed.

Parameters:
  • text (str | None) – The text of the footer

  • icon_url (Asset | str | None) – Icon URL of the footer

Return type:

Self

Returns:

Returns the embed you are editing

Remove the footer from the embed.

Return type:

Self

set_author(*, name, url=None, icon_url=None) → Self

Set the author of the embed.

Parameters:
  • name (str) – The name of the author

  • url (str | None) – The URL which the author name will link to

  • icon_url (Asset | str | None) – The icon URL of the author

Return type:

Self

Returns:

Returns the embed you are editing

remove_author() → Self

Remove the author from the embed.

Return type:

Self

set_image(*, url=None) → Self

Set the image of the embed.

Parameters:

url (Asset | str | None) – The URL of the image

Return type:

Self

Returns:

Returns the embed you are editing

remove_image() → Self

Remove the image from the embed.

Return type:

Self

set_thumbnail(*, url=None) → Self

Set the thumbnail of the embed.

Parameters:

url (Asset | str | None) – The URL of the thumbnail

Return type:

Self

Returns:

Returns the embed you are editing

remove_thumbnail() → Self

Remove the thumbnail from the embed.

Return type:

Self

set_title(value) → Self

Set the title of the embed.

Parameters:

value (str | None) – The title to set the embed to. If None, the title will be removed

Return type:

Self

Returns:

Returns the embed you are editing

remove_title() → Self

Remove the title from the embed.

Return type:

Self

set_description(value) → Self

Set the description of the embed.

Parameters:

value (str | None) – The description to set the embed to. If None, the description will be removed

Return type:

Self

Returns:

Returns the embed you are editing

remove_description() → Self

Remove the description from the embed.

Return type:

Self

set_url(value) → Self

Set the URL of the embed, which the title will link to.

Parameters:

value (str | None) – The URL to set the embed to. If None, the URL will be removed

Return type:

Self

Returns:

Returns the embed you are editing

remove_url() → Self

Remove the URL from the embed.

Return type:

Self

set_timestamp(value) → Self

Set the timestamp of the embed.

Parameters:

value (datetime | None) – The timestamp to set the embed to. If None, the timestamp will be removed

Return type:

Self

Returns:

Returns the embed you are editing

remove_timestamp() → Self

Remove the timestamp from the embed.

Return type:

Self

add_field(*, name, value, inline=True) → Self

Add a field to the embed.

Parameters:
  • name (str) – Title of the field

  • value (str) – Description of the field

  • inline (bool) – Whether the field is inline or not

Return type:

Self

Returns:

Returns the embed you are editing

remove_field(index) → Self

Remove a field from the embed.

Parameters:

index (int) – The index of the field to remove

Return type:

Self

Returns:

Returns the embed you are editing

classmethod from_dict(data) → Self

Create an embed from a dictionary.

Parameters:

data (dict) – The dictionary to create the embed from

Return type:

Self

Returns:

The embed created from the dictionary

to_dict() → dict

The embed as a dictionary.

Return type:

dict

class discord_http.embeds.EmbedAuthor(name, url=None, icon_url=None, proxy_icon_url=None) → None

Bases: object

Represents the author section of an embed.

Parameters:
  • name (str)

  • url (str | None)

  • icon_url (str | None)

  • proxy_icon_url (str | None)

name: str
url: str | None
icon_url: str | None
proxy_icon_url: str | None
to_dict() → dict

Returns a dict representation of the embed author.

Return type:

dict

classmethod from_dict(data) → Self

Creates an EmbedAuthor from a dict provided by Discord.

Return type:

Self

Parameters:

data (dict)

class discord_http.embeds.EmbedField(name, value, inline=True) → None

Bases: object

Represents a field entry in an embed.

Parameters:
name: str
value: str
inline: bool
to_dict() → dict

Returns a dict representation of the embed field.

Return type:

dict

classmethod from_dict(data) → Self

Creates an EmbedField from a dict provided by Discord.

Return type:

Self

Parameters:

data (dict)

class discord_http.embeds.EmbedFooter(text, icon_url=None, proxy_icon_url=None) → None

Bases: object

Represents the footer section of an embed.

Parameters:
  • text (str)

  • icon_url (str | None)

  • proxy_icon_url (str | None)

text: str
icon_url: str | None
proxy_icon_url: str | None
to_dict() → dict

Returns a dict representation of the embed footer.

Return type:

dict

classmethod from_dict(data) → Self

Creates an EmbedFooter from a dict provided by Discord.

Return type:

Self

Parameters:

data (dict)

class discord_http.embeds.EmbedMedia(url) → None

Bases: object

Represents a media entry (image, thumbnail, or video) in an embed.

Parameters:

url (str)

url: str
to_dict() → dict

Returns a dict representation of the embed media.

Return type:

dict

classmethod from_dict(data) → Self

Creates an EmbedMedia from a dict provided by Discord.

Return type:

Self

Parameters:

data (dict)

class discord_http.embeds.EmbedProvider(name=None, url=None) → None

Bases: object

Represents the provider section of an embed, only sent by Discord.

Parameters:
  • name (str | None)

  • url (str | None)

name: str | None
url: str | None
classmethod from_dict(data) → Self

Creates an EmbedProvider from a dict provided by Discord.

Return type:

Self

Parameters:

data (dict)