Add the "respawn" command

This commit is contained in:
Jeff 2024-09-02 11:32:06 -04:00
parent ed2fc13217
commit 60a88f37d4
2 changed files with 11 additions and 0 deletions

View File

@ -36,6 +36,7 @@ The bot is able to respond to the following commands, which must be sent via "/t
- `announce`: Admin-only, sends the announcement message to "/region". This will reset the - `announce`: Admin-only, sends the announcement message to "/region". This will reset the
announcement timer to 45 minutes. announcement timer to 45 minutes.
- `location`: Returns the bot's current town or, if it is not in a town, its current position. - `location`: Returns the bot's current town or, if it is not in a town, its current position.
- `respawn`: Admin-only, repawns the bot's character.
- `sort [count (optional)]`: Admin-only, sorts the inventory once or the given number of times. - `sort [count (optional)]`: Admin-only, sorts the inventory once or the given number of times.
- `pos [x] [y] [z]`: Admin-only, sets the bot's desired position where it will try to stand (must - `pos [x] [y] [z]`: Admin-only, sets the bot's desired position where it will try to stand (must
be close to the bot's current position). be close to the bot's current position).
@ -145,6 +146,7 @@ Then follow the [above](#running) steps with the tag "trade_bot" instead of
## Changelog ## Changelog
- 9/2/2024: - 9/2/2024:
- Added the "respawn" command.
- Added the "location" command. - Added the "location" command.
- Removed the "{location}" feature from the announcement message. Announcements are now sent to - Removed the "{location}" feature from the announcement message. Announcements are now sent to
"/region" so this feature is now used by the "location" command. "/region" so this feature is now used by the "location" command.

View File

@ -329,6 +329,15 @@ impl Bot {
Some(price_correction_message) Some(price_correction_message)
} }
} }
"respawn" => {
if self.is_user_admin(&sender)? {
self.client.respawn();
None
} else {
Some(price_correction_message)
}
}
"sort" => { "sort" => {
if self.is_user_admin(&sender)? { if self.is_user_admin(&sender)? {
if let Some(sort_count) = split_content.next() { if let Some(sort_count) = split_content.next() {