Embed (Legacy)¶
Note
The following classes come from the scurrypy.parts.embed module.
EmbedPart
dataclass
¶
Bases: DataModel
Represents fields for creating an embed.
title: Optional[str] = None
class-attribute
instance-attribute
¶
This embed's title.
description: Optional[str] = None
class-attribute
instance-attribute
¶
This embed's description.
timestamp: Optional[str] = None
class-attribute
instance-attribute
¶
Timestamp of when the embed was sent.
color: Optional[int] = None
class-attribute
instance-attribute
¶
Embed's accent color.
author: Optional[EmbedAuthorPart] = None
class-attribute
instance-attribute
¶
Embed's author.
thumbnail: Optional[EmbedThumbnailPart] = None
class-attribute
instance-attribute
¶
Embed's thumbnail attachment.
image: Optional[EmbedImagePart] = None
class-attribute
instance-attribute
¶
Embed's image attachment.
fields: Optional[list[EmbedFieldPart]] = field(default_factory=list)
class-attribute
instance-attribute
¶
List of embed's fields.
footer: Optional[EmbedFooterPart] = None
class-attribute
instance-attribute
¶
Embed's footer.
to_dict
¶
EXCEPTION to the "models contain no custom methods" rule for two reasons:
-
to_dictalready exists on all models via inheritance, so overriding it does not break the design model. -
Thumbnail(Component V2) andEmbedThumbnail(Embed-only) are extremely easy to confuse. This guard catches the mistake early and provides a clear, actionable error instead of allowing Discord to return an obscure 400 error.
EmbedAuthorPart
dataclass
¶
Bases: DataModel
Represents fields for creating an embed author.
name: str = None
class-attribute
instance-attribute
¶
Name of the author.
url: Optional[str] = None
class-attribute
instance-attribute
¶
URL of the author. http or attachment://
icon_url: Optional[str] = None
class-attribute
instance-attribute
¶
URL of author's icon. http or attachment://
to_dict
¶
Recursively turns the dataclass into a dictionary and drops empty fields.
Returns:
-
dict–serialized dataclasss
EmbedThumbnailPart
dataclass
¶
EmbedFieldPart
dataclass
¶
Bases: DataModel
Represents fields for creating an embed field.
name: str = None
class-attribute
instance-attribute
¶
Name of the field.
value: str = None
class-attribute
instance-attribute
¶
Value of the field.
inline: Optional[bool] = False
class-attribute
instance-attribute
¶
Whether or not this field should display inline. Defaults to False.
to_dict
¶
Recursively turns the dataclass into a dictionary and drops empty fields.
Returns:
-
dict–serialized dataclasss
EmbedImagePart
dataclass
¶
EmbedFooterPart
dataclass
¶
Bases: DataModel
Represents fields for creating an embed footer.
text: str = None
class-attribute
instance-attribute
¶
Footer text.
icon_url: Optional[str] = None
class-attribute
instance-attribute
¶
URL of the footer icon. http or attachment://
to_dict
¶
Recursively turns the dataclass into a dictionary and drops empty fields.
Returns:
-
dict–serialized dataclasss