Skip to main content

Module util

Module util 

Source
Expand description

Utility helpers: supported-site URL detection, embed formatting.

Functions§

extract_fanfic_url
Extract the first supported fanfiction URL from a string (message content). Returns the URL as-is (normalized by the caller if needed).
format_words
Format a word count compactly: 1234 → “1.2k”, 1500000 → “1.5M”.
normalize_url
Normalize a URL to a form FicHub accepts (add scheme if missing).
truncate
Truncate a string to max chars, appending when cut.