Fix command parsing

This commit is contained in:
Edward Shen 2022-05-05 22:07:20 -07:00
parent 59034086e9
commit c6cee44421
Signed by: edward
GPG key ID: 19182661E818369F

View file

@ -162,14 +162,13 @@ async fn parse_message(event: SyncMessageEvent<MessageEventContent>, room: Joine
}; };
if let Some(message) = message.strip_prefix("!") { if let Some(message) = message.strip_prefix("!") {
if let Some((command, args)) = message.split_once(" ") { let (command, args) = message.split_once(" ").unwrap_or((message, ""));
match command { match command {
"source" => source(room).await?, "source" => source(room).await?,
"uwu" => uwuify(room, args).await?, "uwu" => uwuify(room, args).await?,
_ => unsupported_command(event, room, command).await?, _ => unsupported_command(event, room, command).await?,
} }
} }
}
Ok(()) Ok(())
} }