Improve some logs, comments and docs

This commit is contained in:
Jeff 2024-07-15 22:59:30 -04:00
parent 706d3f4f3d
commit 1e8dc42bfb
2 changed files with 8 additions and 3 deletions

View File

@ -38,7 +38,7 @@ to the container:
```toml ```toml
# config/config.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 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. announcement = "I love cheese! I am at {location}." # Optional. Announcements are sent every 45 minutes. Use {location} to insert the bot's current location.

View File

@ -174,6 +174,8 @@ impl Bot {
} else if self.client.pending_invites().is_empty() { } else if self.client.pending_invites().is_empty() {
match self.trade_mode { match self.trade_mode {
TradeMode::AdminAccess => { 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; self.trade_mode = TradeMode::Trade;
} }
TradeMode::Trade => { TradeMode::Trade => {
@ -364,7 +366,10 @@ impl Bot {
.ok_or("Failed to find trade party")?; .ok_or("Failed to find trade party")?;
let their_party = if my_party == 0 { 1 } else { 0 }; let their_party = if my_party == 0 { 1 } else { 0 };
let their_uid = trade.parties[their_party]; 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 { match result {
TradeResult::Completed => { TradeResult::Completed => {
@ -384,7 +389,7 @@ impl Bot {
} }
if let TradeMode::AdminAccess = self.trade_mode { 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; self.trade_mode = TradeMode::Trade;
} }