more tracing

This commit is contained in:
Xiretza 2022-11-13 10:57:47 +01:00
parent cc09f22432
commit efce5f22d6

View file

@ -57,6 +57,7 @@ pub enum OpenState {
Closed, Closed,
} }
#[instrument(skip(api))]
async fn get_open_state(api: &ItsApi) -> Result<OpenState> { async fn get_open_state(api: &ItsApi) -> Result<OpenState> {
let state = api let state = api
.status() .status()
@ -210,15 +211,19 @@ impl Bot {
ev: &OriginalRoomMessageEvent, ev: &OriginalRoomMessageEvent,
room: &Joined, room: &Joined,
) -> Result<()> { ) -> Result<()> {
event!(Level::TRACE, ?ev, "handling message");
if Some(&*ev.sender) == self.client.user_id() { if Some(&*ev.sender) == self.client.user_id() {
event!(Level::TRACE, "message from ourselves, ignoring");
return Ok(()); return Ok(());
} }
let MessageType::Text(TextMessageEventContent { body, .. }) = &ev.content.msgtype else { let MessageType::Text(TextMessageEventContent { body, .. }) = &ev.content.msgtype else {
event!(Level::TRACE, "non-plaintext message, ignoring");
return Ok(()); return Ok(());
}; };
let Some(command) = body.strip_prefix(&self.config.app.command_prefix) else { let Some(command) = body.strip_prefix(&self.config.app.command_prefix) else {
event!(Level::TRACE, "non-command message, ignoring");
return Ok(()); return Ok(());
}; };