diff --git a/bot/src/bot.rs b/bot/src/bot.rs index 1eea2ac..60308bc 100644 --- a/bot/src/bot.rs +++ b/bot/src/bot.rs @@ -243,11 +243,15 @@ struct CodeBlock { #[async_trait] impl<'a> poise::PopArgument<'a> for CodeBlock { async fn pop_from( - args: &'a str, + mut args: &'a str, attachment_index: usize, ctx: &serenity::prelude::Context, message: &poise::serenity_prelude::Message, ) -> Result<(&'a str, usize, Self), (PoiseError, Option)> { + if let Some(code_block_start) = args.find("```") { + args = &args[code_block_start..]; + } + let (rest, attachment_index, code_block) = poise::prefix_argument::CodeBlock::pop_from(args, attachment_index, ctx, message).await?;