From c6cee444217b9c2ad8611bb61a13466c8507c004 Mon Sep 17 00:00:00 2001 From: Edward Shen Date: Thu, 5 May 2022 22:07:20 -0700 Subject: [PATCH] Fix command parsing --- src/main.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index b5d90f4..608057d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -162,12 +162,11 @@ async fn parse_message(event: SyncMessageEvent, room: Joine }; if let Some(message) = message.strip_prefix("!") { - if let Some((command, args)) = message.split_once(" ") { - match command { - "source" => source(room).await?, - "uwu" => uwuify(room, args).await?, - _ => unsupported_command(event, room, command).await?, - } + let (command, args) = message.split_once(" ").unwrap_or((message, "")); + match command { + "source" => source(room).await?, + "uwu" => uwuify(room, args).await?, + _ => unsupported_command(event, room, command).await?, } }