Embeds

The following section documents everything related to embeds. Embeds usually can be found inside messages.

Models

BaseEmbed

Methods
class stoat.BaseEmbed[source]

Base class for message embeds.

abstractmethod attach_state(state, /)[source]

Embed: Attach a state to embed.

Parameters:

state (State) – The state to attach.

BaseEmbedSpecial

class stoat.BaseEmbedSpecial[source]

Information about special remote content.

NoneEmbedSpecial

Methods
class stoat.NoneEmbedSpecial[source]

No remote content.

This inherits from BaseEmbedSpecial.

to_dict()[source]

dict: Convert embed special to raw data.

GIFEmbedSpecial

Methods
class stoat.GIFEmbedSpecial[source]

A content hint that embed contains a GIF. Metadata should be used to find video or image to play.

This inherits from BaseEmbedSpecial.

to_dict()[source]

dict: Convert embed special to raw data.

YouTubeEmbedSpecial

Attributes
Methods
class stoat.YouTubeEmbedSpecial(*, id, timestamp)[source]

Represents information about Youtube video.

This inherits from BaseEmbedSpecial.

id

The video ID.

Type:

str

timestamp

The video timestamp.

Type:

Optional[str]

to_dict()[source]

dict: Convert embed special to raw data.

LightspeedEmbedSpecial

Attributes
Methods
class stoat.LightspeedEmbedSpecial(*, content_type, id)[source]

Represents information about Lightspeed.tv stream.

This inherits from BaseEmbedSpecial.

content_type

The Lightspeed.tv content type.

Type:

LightspeedContentType

id

The Lightspeed.tv stream ID.

Type:

str

to_dict()[source]

dict: Convert embed special to raw data.

TwitchEmbedSpecial

Attributes
Methods
class stoat.TwitchEmbedSpecial(*, content_type, id)[source]

Represents information about Twitch stream or clip.

This inherits from BaseEmbedSpecial.

content_type

The Twitch content type.

Type:

TwitchContentType

id

The Twitch content ID.

Type:

str

to_dict()[source]

dict: Convert embed special to raw data.

SpotifyEmbedSpecial

Attributes
Methods
class stoat.SpotifyEmbedSpecial(*, content_type, id)[source]

Represents information about Spotify track.

This inherits from BaseEmbedSpecial.

content_type

The Spotify content type.

Type:

str

id

The Spotify content ID.

Type:

str

to_dict()[source]

dict: Convert embed special to raw data.

SoundcloudEmbedSpecial

Methods
class stoat.SoundcloudEmbedSpecial[source]

Represents information about Soundcloud track.

This inherits from BaseEmbedSpecial.

to_dict()[source]

dict: Convert embed special to raw data.

BandcampEmbedSpecial

Attributes
Methods
class stoat.BandcampEmbedSpecial(*, content_type, id)[source]

Represents information about Bandcamp track.

This inherits from BaseEmbedSpecial.

content_type

The Bandcamp content type.

Type:

BandcampContentType

id

The Bandcamp content ID.

Type:

str

to_dict()[source]

dict: Convert embed special to raw data.

AppleMusicEmbedSpecial

Attributes
Methods
class stoat.AppleMusicEmbedSpecial(*, album_id, track_id)[source]

Represents information about Apple Music track.

This inherits from BaseEmbedSpecial.

album_id

The Apple Music album ID.

Type:

str

track_id

The Apple Music track ID.

Type:

Optional[str]

to_dict()[source]

dict: Convert embed special to raw data.

StreamableEmbedSpecial

Attributes
Methods
class stoat.StreamableEmbedSpecial(*, id)[source]

Represents information about Streamable video.

This inherits from BaseEmbedSpecial.

id

The video ID.

Type:

str

to_dict()[source]

dict: Convert embed special to raw data.

ImageEmbed

Attributes
Methods
class stoat.ImageEmbed(*, url, width, height, size)[source]

Represents an image in an embed.

This inherits from BaseEmbed.

url

The URL to the original image.

Type:

str

width

The width of the image.

Type:

int

height

The height of the image.

Type:

int

size

The positioning and size of the image.

Type:

ImageSize

attach_state(state, /)[source]

Embed: Attach a state to embed.

Parameters:

state (State) – The state to attach.

to_dict(*, as_embed=True)[source]

dict: Convert embed to raw data.

Parameters:

as_embed (bool) – Whether to serialize image as embed. If set to False, this means removal of type key in root object. Defaults to True.

VideoEmbed

Attributes
Methods
class stoat.VideoEmbed(*, url, width, height)[source]

Represents a video in an embed.

This inherits from BaseEmbed.

url

The URL to the original video.

Type:

str

width

The width of the video.

Type:

int

height

The height of the video.

Type:

int

attach_state(state, /)[source]

Embed: Attach a state to embed.

Parameters:

state (State) – The state to attach.

to_dict(*, as_embed=True)[source]

dict: Convert embed to raw data.

Parameters:

as_embed (bool) – Whether to serialize video as embed. If set to False, this means removal of type key in root object. Defaults to True.

WebsiteEmbed

class stoat.WebsiteEmbed(*, url, original_url, special, title, description, image, video, site_name, icon_url, color)[source]

Represents website embed within Stoat message.

This inherits from BaseEmbed.

url

The direct URL to web page.

Type:

Optional[str]

original_url

The original direct URL.

Type:

Optional[str]

special

The remote content.

Type:

Optional[EmbedSpecial]

title

The title of website.

Type:

Optional[str]

description

The description of website.

Type:

Optional[str]

image

The embedded image.

Type:

Optional[ImageEmbed]

video

The embedded video.

Type:

Optional[VideoEmbed]

site_name

The site name.

Type:

Optional[str]

icon_url

The URL to site icon.

Type:

Optional[str]

color

The embed’s CSS color.

Type:

Optional[str]

attach_state(state, /)[source]

Embed: Attach a state to embed.

Parameters:

state (State) – The state to attach.

to_dict(*, as_embed=True)[source]

dict: Convert embed to raw data.

Parameters:

as_embed (bool) – Whether to serialize website metadata as embed. If set to False, this means removal of type key in root object. Defaults to True.

StatelessTextEmbed

class stoat.StatelessTextEmbed(*, icon_url, url, title, description, internal_media, color)[source]

Represents stateless text embed within Stoat message.

This inherits from BaseEmbed.

icon_url

The URL to site icon.

Type:

Optional[str]

url

The direct URL to web page.

Type:

Optional[str]

title

The embed’s title.

Type:

Optional[str]

description

The embed’s description.

Type:

Optional[str]

internal_media

The stateless embed media.

Type:

Optional[StatelessAsset]

color

The embed’s CSS color.

Type:

Optional[str]

attach_state(state, /)[source]

Embed: Attach a state to embed.

Parameters:

state (State) – The state to attach.

to_dict(*, as_embed=True)[source]

dict: Convert embed to raw data.

Parameters:

as_embed (bool) – Whether to serialize text metadata as embed. If set to False, this means removal of type key in root object. Defaults to True.

TextEmbed

class stoat.TextEmbed(*, icon_url, url, title, description, internal_media, color, state)[source]

Represents a text embed within Stoat message.

This is a stateful version of StatelessTextEmbed, and inherits from it.

attach_state(state, /)[source]

Embed: Attach a state to embed.

Parameters:

state (State) – The state to attach.

color

The embed’s CSS color.

Type:

Optional[str]

description

The embed’s description.

Type:

Optional[str]

icon_url

The URL to site icon.

Type:

Optional[str]

internal_media

The stateless embed media.

Type:

Optional[StatelessAsset]

title

The embed’s title.

Type:

Optional[str]

to_dict(*, as_embed=True)[source]

dict: Convert embed to raw data.

Parameters:

as_embed (bool) – Whether to serialize text metadata as embed. If set to False, this means removal of type key in root object. Defaults to True.

url

The direct URL to web page.

Type:

Optional[str]

property media[source]

The embed media.

Type:

Optional[Asset]

NoneEmbed

Methods
class stoat.NoneEmbed[source]

Embed that holds nothing.

This inherits from BaseEmbed.

attach_state(state, /)[source]

Embed: Attach a state to embed.

Parameters:

state (State) – The state to attach.

to_dict()[source]

dict: Convert embed to raw data.

EmbedSpecial

class stoat.EmbedSpecial

An union of all embed special types.

The following classes are included in this union:

StatelessEmbed

class stoat.StatelessEmbed

An union of all stateless embed types.

The following classes are included in this union:

Embed

class stoat.Embed

An union of all embed types.

The following classes are included in this union:

SendableEmbed

class stoat.SendableEmbed(title=None, description=None, *, icon_url=None, url=None, media=None, color=None)[source]

Represents a text embed before it is sent.

icon_url

The embed icon URL.

Type:

Optional[str]

url

The embed URL.

Type:

Optional[str]

title

The embed’s title.

Type:

Optional[str]

description

The embed’s description.

Type:

Optional[str]

media

The file inside the embed.

Type:

Optional[ResolvableResource]

color

The embed color. This must be valid CSS color.

Type:

Optional[str]

await to_dict(state, /)[source]

Convert sendable embed to raw data.

Parameters:

state (State) – The state. Required to resolve media attribute into file ID.

Returns:

The raw data.

Return type:

dict