Add minor optimization

This commit is contained in:
Jeff 2024-07-16 11:36:11 -04:00
parent 37e4c5c8d7
commit c52613fa20
2 changed files with 22 additions and 17 deletions

View File

@ -15,7 +15,7 @@ you are familiar with Rust.
intended to be a fun addition to the game that can help players trade items with each other.
- This project may have bugs. You are encouraged to report them to the author but the author takes
no responsibility for any lost items. **No such incidents have been reported so far.**
- This program **handles your password securely** and does nothing with it expect connecting to the
- This program **handles your password securely** and does nothing with it except connecting to the
veloren server during launch. However, third-party video game software is often infected with
malware. You should **review the source code** or ask someone you trust to do so for you.
- You are welcome to make changes to the code or fork the project. The author is open to

View File

@ -443,6 +443,7 @@ impl Bot {
);
if let Some(announcement) = &self.announcement {
let announcement = if announcement.contains("{location}") {
let location = self
.client
.sites()
@ -458,10 +459,14 @@ impl Bot {
}
})
.unwrap_or(format!("{:?}", self.position));
let interpolated_announcement = announcement.replace("{location}", &location);
announcement.replace("{location}", &location)
} else {
announcement.clone()
};
self.client
.send_command("world".to_string(), vec![interpolated_announcement]);
.send_command("world".to_string(), vec![announcement]);
}
Ok(())