From 1e8dc42bfb9e9168d0a576ef0a76fc7bef64d9ff Mon Sep 17 00:00:00 2001 From: Jeff Date: Mon, 15 Jul 2024 22:59:30 -0400 Subject: [PATCH] Improve some logs, comments and docs --- README.md | 2 +- src/bot.rs | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index af3c792..db84d8e 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ to the container: ```toml # config/config.toml -position = [0, 0, 0] # Change these to the desired X, Y, Z coordinates +position = [0, 0, 0] # Change these to the desired X, Y, Z coordinates. The bot will try to stand here, but the coordinates must be close to the bot's spawn point. orientation = 0 # 0 = North, 90 = West, 180 = South, 270 = East announcement = "I love cheese! I am at {location}." # Optional. Announcements are sent every 45 minutes. Use {location} to insert the bot's current location. diff --git a/src/bot.rs b/src/bot.rs index 07d53ca..c8df9f0 100644 --- a/src/bot.rs +++ b/src/bot.rs @@ -174,6 +174,8 @@ impl Bot { } else if self.client.pending_invites().is_empty() { match self.trade_mode { TradeMode::AdminAccess => { + // This should never happen, but in case the server fails to send a trade + // invite, the bot will switch to trade mode. self.trade_mode = TradeMode::Trade; } TradeMode::Trade => { @@ -364,7 +366,10 @@ impl Bot { .ok_or("Failed to find trade party")?; let their_party = if my_party == 0 { 1 } else { 0 }; let their_uid = trade.parties[their_party]; - let their_name = self.find_name(&their_uid).ok_or("Failed to find name")?; + let their_name = self + .find_name(&their_uid) + .ok_or("Failed to find name")? + .clone(); match result { TradeResult::Completed => { @@ -384,7 +389,7 @@ impl Bot { } if let TradeMode::AdminAccess = self.trade_mode { - log::info!("End of admin access"); + log::info!("End of admin access for {their_name}"); self.trade_mode = TradeMode::Trade; }