[−][src]Function serenity::utils::content_safe
pub fn content_safe(
cache: impl AsRef<CacheRwLock>,
s: impl AsRef<str>,
options: &ContentSafeOptions
) -> String
Transforms role, channel, user, @everyone
and @here
mentions
into raw text by using the Cache
only.
ContentSafeOptions
decides what kind of mentions should be filtered
and how the raw-text will be displayed.
Examples
Sanitise an @everyone
mention.
use serenity::utils::{ content_safe, ContentSafeOptions, }; let with_mention = "@everyone"; let without_mention = content_safe(&cache, &with_mention, &ContentSafeOptions::default()); assert_eq!("@\u{200B}everyone".to_string(), without_mention);