Skip to content

embeds

Discord Embed Creation Utilities for Tux Bot.

This module provides utilities for creating standardized Discord embeds with consistent styling, colors, and formatting across the bot.

Classes:

  • EmbedType

    Enumeration of available embed types with predefined styles.

  • EmbedCreator

    Utility class for creating standardized Discord embeds.

Classes

EmbedType

Bases: Enum

Enumeration of available embed types with predefined styles.

EmbedCreator

Utility class for creating standardized Discord embeds.

Methods:

  • create_embed

    Create a customized Discord embed based on the specified type and parameters.

  • get_footer

    Generate footer text and icon for embeds.

Functions

create_embed staticmethod
Python
create_embed(
    embed_type: EmbedType,
    bot: Tux | None = None,
    title: str | None = None,
    description: str | None = None,
    user_name: str | None = None,
    user_display_avatar: str | None = None,
    image_url: str | None = None,
    thumbnail_url: str | None = None,
    message_timestamp: datetime | None = None,
    custom_footer_text: str | None = None,
    custom_footer_icon_url: str | None = None,
    custom_author_text: str | None = None,
    custom_author_text_url: str | None = None,
    custom_author_icon_url: str | None = None,
    custom_color: int | Colour | None = None,
    hide_author: bool = False,
    hide_timestamp: bool = False,
) -> Embed

Create a customized Discord embed based on the specified type and parameters.

Parameters:

  • embed_type (EmbedType) –

    Determines the default color and icon for the embed.

  • bot (Tux, default: None ) –

    If provided, used to display bot latency in the footer.

  • title (str, default: None ) –

    The embed's title. At least one of title or description should be provided.

  • description (str, default: None ) –

    The embed's main content. At least one of title or description should be provided.

  • user_name (str, default: None ) –

    Used in footer if provided, otherwise defaults to bot's username.

  • user_display_avatar (str, default: None ) –

    User's avatar URL for the footer icon.

  • image_url (str, default: None ) –

    URL for the embed's main image.

  • thumbnail_url (str, default: None ) –

    URL for the embed's thumbnail image.

  • message_timestamp (datetime, default: None ) –

    Custom timestamp for the embed.

  • custom_footer_text (str, default: None ) –

    Overrides default footer text if provided.

  • custom_footer_icon_url (str, default: None ) –

    Overrides default footer icon if provided.

  • custom_author_text (str, default: None ) –

    Overrides default author text if provided.

  • custom_author_text_url (str, default: None ) –

    Adds author URL if provided.

  • custom_author_icon_url (str, default: None ) –

    Overrides default author icon if provided.

  • hide_author (bool, default: False ) –

    If True, removes the author from the embed.

  • custom_color (int or Colour, default: None ) –

    Overrides default color for the embed type if provided.

Returns:

  • Embed

    The customized Discord embed.

Python
get_footer(
    bot: Tux | None = None,
    user_name: str | None = None,
    user_display_avatar: str | None = None,
) -> tuple[str, str | None]

Generate footer text and icon for embeds.

Parameters:

  • bot (Tux, default: None ) –

    The bot instance to get latency from.

  • user_name (str, default: None ) –

    Username to include in footer.

  • user_display_avatar (str, default: None ) –

    User avatar URL for footer icon.

Returns:

  • tuple[str, str | None]

    Tuple of (footer_text, avatar_url).