Sanitize mentions on call
This commit is contained in:
@@ -11,6 +11,12 @@ pub trait SanitizeDiscordMarkdown {
|
||||
/// Returns:
|
||||
/// [`String`] - The sanitized string.
|
||||
fn sanitize(&self, hard: bool) -> String;
|
||||
|
||||
/// Sanitizes mentions in a string.
|
||||
///
|
||||
/// Returns:
|
||||
/// [`String`] - The sanitized string.
|
||||
fn sanitize_mentions(&self) -> String;
|
||||
}
|
||||
|
||||
impl<T> SanitizeDiscordMarkdown for T
|
||||
@@ -40,7 +46,13 @@ where
|
||||
};
|
||||
|
||||
// Now block ping attempts — break mentions
|
||||
escaped
|
||||
escaped.sanitize_mentions()
|
||||
}
|
||||
|
||||
fn sanitize_mentions(&self) -> String {
|
||||
let input = self.to_string();
|
||||
|
||||
input
|
||||
.replace("@everyone", "@\u{200B}everyone")
|
||||
.replace("@here", "@\u{200B}here")
|
||||
.replace("<@", "<@\u{200B}") // user mentions
|
||||
|
||||
Reference in New Issue
Block a user