aboutsummaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
authorNathan Ringo <nathan@remexre.com>2024-01-19 23:31:25 -0600
committerNathan Ringo <nathan@remexre.com>2024-01-19 23:31:25 -0600
commitd1bf15fdc63e7bb095a88368729c0b52b0cf28d4 (patch)
tree67dab5cde3a1055000e9c289fa1686f3dc938c65 /src/commands
parent6bea013cc69b8d11c24fd1e6041677e8e9310f66 (diff)
Ensure that content will fit.
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/discocaml.rs9
1 files changed, 8 insertions, 1 deletions
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<E: std::error::Error, F: Future<Output = Result<(),
err: &Error,
send: impl FnOnce(CreateInteractionResponse) -> 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!(