Module discord_lumberjack.message_creators.embed

Functions

def embed_length(embed: Embed) ‑> int

Calculates the total length of the size-limited fields of an embed.

Args

embed : Embed
The embed to calculate the length of.

Returns

int
The total length of the size-limited fields of the embed.
def empty_embed(n_fields: int = 0) ‑> Embed

Create an empty embed with the specified number of empty fields.

Args

n_fields : int, optional
The number of empty fields to initialise the embed with. Defaults to 0.

Returns

Embed
An empty embed.

Classes

class Embed (*args, **kwargs)

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Ancestors

  • builtins.dict

Class variables

var authorEmbedAuthor
var color : Optional[int]
var description : Optional[str]
var fields : List[EmbedField]
var footerEmbedFooter
var imageEmbedImage
var thumbnailEmbedImage
var timestamp : Optional[str]
var title : Optional[str]
var url : Optional[str]
class EmbedAuthor (*args, **kwargs)

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Ancestors

  • builtins.dict

Class variables

var icon_url : Optional[str]
var name : str
var proxy_icon_url : Optional[str]
var url : Optional[str]
class EmbedField (*args, **kwargs)

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Ancestors

  • builtins.dict

Class variables

var inline : bool
var name : str
var value : str
class EmbedFieldSetter (key_chain: Sequence[Union[str, int]], get_value: Callable[[logging.LogRecord], Any], limit: Optional[int] = None)

Sets a field of an embed as specified by the user, providing a mechanism for not overflowing the embeds.

Args

key_chain (Sequence[str | int]): A sequence of the keys (at least one) to index the embed with. For example if the value v should be set like this, embed["fields"][2]["name"] = v, then the key_chain would be ("fields", 2, "name").
get_value : Callable[[LogRecord], Any]
A function that gets a value to pass to set_value from a log record.
limit : int
The limit of the field this EmbedFieldSetter is setting.

Methods

def set_field(self, embed: Embed, record: logging.LogRecord, remainder: str = None, new_embed_creator: Callable[[logging.LogRecord], Embed] = None, remaining_global_limit: Optional[int] = None) ‑> Generator[Embed, Any, None]

[summary]

Args

embed : Embed
The embed to set the field in.
record : LogRecord
The log record containing the data to set.
remainder : str, optional
The text that should have been in the same field of the previous embed but couldn't be set due to length limitations. Defaults to None.
new_embed_creator : Callable[[LogRecord], Embed], optional
A function that generates a new embed and sets whatever fields will persist across all the embeds that a log record is split up into. Defaults to a function that returns an empty embed.
remaining_global_limit : Optional[int], optional
The number of remaining characters that can be added to limited fields of the embed before it is split up. Defaults to None.

Yields

Embed
This function yields any embeds which it creates.

Raises

KeyError
If the key chain is invalid.
class EmbedFooter (*args, **kwargs)

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Ancestors

  • builtins.dict

Class variables

var icon_url : Optional[str]
var text : Optional[str]
class EmbedImage (*args, **kwargs)

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Ancestors

  • builtins.dict

Class variables

var height : Optional[int]
var proxy_url : Optional[str]
var url : Optional[str]
var width : Optional[int]