fix: improve body truncation for Discord messages to respect character boundaries

This commit is contained in:
암냥 2026-02-03 14:03:50 +09:00
commit 19be697f86
No known key found for this signature in database

View file

@ -89,7 +89,11 @@ fn run_monitor(config: &Config) -> Result<(), Box<dyn std::error::Error>> {
// Truncate body if too long for Discord (limit is 2000 chars)
let display_body = if body_content.len() > 1500 {
format!("{}...", &body_content[..1500])
let mut end = 1500;
while !body_content.is_char_boundary(end) {
end -= 1;
}
format!("{}...", &body_content[..end])
} else {
body_content
};