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,12 +162,11 @@ async fn parse_message(event: SyncMessageEvent<MessageEventContent>, 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?,
}
}