Skip to content

Commit 1340bf1

Browse files
authored
Merge pull request #2208 from Urgau/zulip-cmd-skip-one
Skip `@**triagebot**` when parsing Zulip command in a stream
2 parents e352a7a + f264793 commit 1340bf1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/zulip.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,16 @@ async fn handle_command<'a>(
282282
continue;
283283
};
284284

285+
// Skip @**triagebot**
286+
let cmd_index = cmd_index + 1;
287+
288+
// Error on unexpected end-of-line
289+
if cmd_index >= words.len() {
290+
return Ok(Some(
291+
"Error parsing command: unexpected end-of-line".to_string(),
292+
));
293+
}
294+
285295
let cmd = parse_cli::<StreamCommand, _>(words[cmd_index..].iter().copied())?;
286296
tracing::info!("command parsed to {cmd:?}");
287297

0 commit comments

Comments
 (0)