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

View file

@ -161,8 +161,8 @@ async fn parse_message(event: SyncMessageEvent<MessageEventContent>, room: Joine
_ => return Ok(()), _ => return Ok(()),
}; };
if let Some(message) = message.strip_prefix("!") { if let Some(message) = message.strip_prefix('!') {
let (command, args) = message.split_once(" ").unwrap_or((message, "")); 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?,
@ -190,7 +190,7 @@ async fn unsupported_command(
room: Joined, room: Joined,
command: &str, command: &str,
) -> Result<()> { ) -> Result<()> {
let resp = original_event.into_full_event(room.room_id().to_owned()); let resp = original_event.into_full_event(room.room_id().clone());
let content = let content =
MessageEventContent::notice_reply_plain(format!("Unknown command `{command}`"), &resp); MessageEventContent::notice_reply_plain(format!("Unknown command `{command}`"), &resp);
room.send(content, None).await?; room.send(content, None).await?;