Log Matrix messages

This commit is contained in:
ErrorNoInternet 2023-01-28 22:51:35 +08:00
parent 3836ad8094
commit 38c1240998
Signed by untrusted user who does not match committer: ErrorNoInternet
GPG Key ID: 2486BFB7B1E6A4A3

View File

@ -110,16 +110,25 @@ async fn room_message_handler(
return; return;
} }
}; };
let command = &text_content
.body
.trim_start_matches(&state.display_name)
.trim_start_matches(":")
.trim()
.to_string();
log_message(
Matrix,
&format!(
"Executing command from {}: {}",
event.sender.to_string(),
command
),
);
log_error( log_error(
room.send( room.send(
RoomMessageEventContent::text_plain( RoomMessageEventContent::text_plain(
&crate::bot::process_command( &crate::bot::process_command(
&text_content &command,
.body
.trim_start_matches(&state.display_name)
.trim_start_matches(":")
.trim()
.to_string(),
&event.sender.to_string(), &event.sender.to_string(),
&mut client, &mut client,
bot_state.clone(), bot_state.clone(),