Fix command parsing

master
Edward Shen 2022-05-05 22:07:20 -07:00
parent 59034086e9
commit c6cee44421
Signed by: edward
GPG Key ID: 19182661E818369F
1 changed files with 5 additions and 6 deletions

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?,
}
}