Skip to main content

Module expand

Module expand 

Source
Expand description

Link expansion module.

This module provides common types for expanding various types of links (Discord message links, GitHub permalinks, etc.) into rich preview content.

Re-exportsยง

use crate::config::BabyriteConfig; ๐Ÿ”’
use crate::context::BotContext; ๐Ÿ”’
use regex::Regex; ๐Ÿ”’
use std::collections::HashSet; ๐Ÿ”’
use twilight_model::channel::Message; ๐Ÿ”’
use twilight_model::channel::message::Embed; ๐Ÿ”’
use twilight_model::id::Id; ๐Ÿ”’
use twilight_model::id::marker::GuildMarker; ๐Ÿ”’

Modulesยง

discord
Discord message link expansion.
github
GitHub Permalink expansion.

Structsยง

ExpandContext
Shared inputs for expanding the links of one message.

Enumsยง

ExpandError
Errors that can occur during link expansion.
ExpandedContent
Expanded content produced by a link expander.

Constantsยง

MAX_LINKS_PER_MESSAGE ๐Ÿ”’
Maximum number of links expanded per message.

Staticsยง

EXPANDERS
All registered link expanders, in the order their results appear in a reply.

Traitsยง

LinkExpander
A link expander: parses its own link type out of a message and expands each link into ExpandedContent.

Functionsยง

parse_links ๐Ÿ”’
Extracts links matching regex from text, applying the shared link policy: URLs wrapped in angle brackets (e.g. <https://...>) are skipped, duplicate URLs are ignored, and at most MAX_LINKS_PER_MESSAGE links are returned.