From d1bf15fdc63e7bb095a88368729c0b52b0cf28d4 Mon Sep 17 00:00:00 2001 From: Nathan Ringo Date: Fri, 19 Jan 2024 23:31:25 -0600 Subject: Ensure that content will fit. --- src/commands/discocaml.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/commands/discocaml.rs b/src/commands/discocaml.rs index 6defac0..e6b1a0b 100644 --- a/src/commands/discocaml.rs +++ b/src/commands/discocaml.rs @@ -182,8 +182,15 @@ async fn respond_with_error F, ) { + let mut content = format!(":no_entry_sign: {}", err); + if let Some((i, _)) = content.char_indices().nth(1997) { + content.truncate(i); + assert_eq!(content.chars().count(), 1997); + content.push_str("…"); + } + let msg = CreateInteractionResponseMessage::new() - .content(format!(":no_entry_sign: {}", err)) + .content(content) .flags(InteractionResponseFlags::EPHEMERAL); if let Err(err) = send(CreateInteractionResponse::Message(msg)).await { log::error!( -- cgit v1.2.3