Skip to content

Commit

Permalink
Ignore text before code block
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfbacon committed May 27, 2024
1 parent a19a8ff commit 5ba67c5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bot/src/bot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>)> {
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?;

Expand Down

0 comments on commit 5ba67c5

Please sign in to comment.