Function serenity::utils::content_safe [−][src]
pub async fn content_safe(
cache: impl AsRef<Cache>,
s: impl AsRef<str>,
options: &ContentSafeOptions
) -> String
Expand description
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()).await;
assert_eq!("@\u{200B}everyone".to_string(), without_mention);