bail on oversized result
This commit is contained in:
parent
980db8afff
commit
3db5d719d2
1 changed files with 8 additions and 2 deletions
10
src/main.rs
10
src/main.rs
|
|
@ -207,9 +207,15 @@ pub async fn roll(ctx: &Context, command: &CommandInteraction) -> anyhow::Result
|
||||||
.buffers
|
.buffers
|
||||||
.push(format!("-# Expected value: {ev} | Seed: {seed}"));
|
.push(format!("-# Expected value: {ev} | Seed: {seed}"));
|
||||||
|
|
||||||
let text_components = Arc::into_inner(discord_md)
|
let discord_md = Arc::into_inner(discord_md)
|
||||||
.unwrap()
|
.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
|
.buffers
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|text| CreateContainerComponent::TextDisplay(CreateTextDisplay::new(text)))
|
.map(|text| CreateContainerComponent::TextDisplay(CreateTextDisplay::new(text)))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue