mongoose.forward.discord

class mongoose.forward.discord.DiscordFormatter[source]

Bases: BaseFormatter

Formats network events into Discord webhook payloads with embed size enforcement.

The formatter tries to create informative embeds while respecting Discord’s size limits. When an object contains many fields, only the most important are used, and long values are truncated.

static format(data)[source]

Return a Discord webhook JSON payload for the given model instance.

Parameters:

data (Any) – The model instance (e.g., NetworkAlert).

Returns:

A JSON-serializable dict following Discord webhook payload format.

Return type:

Dict[str, Any]

class mongoose.forward.discord.DiscordForwarder(config)[source]

Bases: BaseForwarder

Sends payloads to Discord webhooks using the DiscordForwarderConfiguration.

This class follows the project’s forwarder retry semantics but customizes the retry logic: HTTP 4xx responses are considered non-retryable, 5xx and network errors are retryable according to the configured retry_count/retry_delay.

forward(data)[source]

Process and forward the data.

To be implemented by subclasses.

Parameters:

data (Any) – The data to forward.