Skip to content

Commit

Permalink
Use correct ChatKind formatting, bold system chat events
Browse files Browse the repository at this point in the history
  • Loading branch information
yungcomputerchair committed Jan 10, 2025
1 parent 47fdd16 commit ff97077
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,19 @@ async fn handle_chat_event(globals: &Globals, chat: ChatEvent) -> Result<()> {
return Ok(());
};

let message = match chat.to {
let mut message = match chat.to {
Some(to) => format!(
"[{:?}] {} (to {}): {}",
"[{}] {} (to {}): {}",
chat.kind, chat.from, to, chat.message
),
None => format!("[{:?}] {}: {}", chat.kind, chat.from, chat.message),
None => format!("[{}] {}: {}", chat.kind, chat.from, chat.message),
};

// system messages should be bolded
if chat.from == "SYS" {
message = format!("**{}**", message);
}

send_message(channel, &message).await?;
Ok(())
}
Expand Down

0 comments on commit ff97077

Please sign in to comment.