diff --git a/src/main.rs b/src/main.rs index dc7ad18..e2638a5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -207,9 +207,15 @@ pub async fn roll(ctx: &Context, command: &CommandInteraction) -> anyhow::Result .buffers .push(format!("-# Expected value: {ev} | Seed: {seed}")); - let text_components = Arc::into_inner(discord_md) + let discord_md = Arc::into_inner(discord_md) .unwrap() - .into_inner()? + .into_inner()?; + + if discord_md.character_count() > 4000 { + bail!("Resulting message was too long, please roll fewer dice!"); + } + + let text_components = discord_md .buffers .into_iter() .map(|text| CreateContainerComponent::TextDisplay(CreateTextDisplay::new(text)))