Add automated warning and banning

This commit is contained in:
2025-08-14 23:18:43 -03:00
parent 8e0c591b21
commit 6dde25aa72
10 changed files with 587 additions and 36 deletions
+18
View File
@@ -54,3 +54,21 @@ pub trait Bye: Sized {
}
impl<T> Bye for T {}
/// Trims a string to a maximum length, adding an ellipsis if it exceeds the limit.
///
/// Arguments:
/// * `string` - The string to trim with ellipse.
/// * `max_length` - The max length the string may have.
///
/// Returns:
/// [`String`] - The trimmed string with an ellipsis if it exceeded the limit.
pub fn ellipse(string: String, max_length: usize) -> String {
if string.len() <= max_length {
string
} else {
let len = max_length.saturating_sub(3);
format!("{}...", &string[..len])
}
}