Add Location command
This commit is contained in:
parent
db65c11395
commit
6447bc0bb6
13
src/bot.rs
13
src/bot.rs
@ -16,6 +16,7 @@ pub enum Command {
|
||||
Help,
|
||||
Wait,
|
||||
Online,
|
||||
Location,
|
||||
BotStatus,
|
||||
Whitelist,
|
||||
WhitelistAdd,
|
||||
@ -69,6 +70,7 @@ pub async fn process_command(
|
||||
"help" => command = Command::Help,
|
||||
"wait" => command = Command::Wait,
|
||||
"online" => command = Command::Online,
|
||||
"location" => command = Command::Location,
|
||||
"bot_status" => command = Command::BotStatus,
|
||||
"whitelist" => command = Command::Whitelist,
|
||||
"whitelist_add" => command = Command::WhitelistAdd,
|
||||
@ -173,6 +175,17 @@ pub async fn process_command(
|
||||
paged_players.join(", ")
|
||||
);
|
||||
}
|
||||
Command::Location => {
|
||||
let world = client.world.read();
|
||||
let entity = match world.entity(client.entity_id.read().to_owned()) {
|
||||
Some(entity) => entity,
|
||||
None => return "Uh oh! An unknown error occurred!".to_string(),
|
||||
};
|
||||
return format!(
|
||||
"I am currently at {} {} {}!",
|
||||
entity.last_pos.x as i32, entity.last_pos.y as i32, entity.last_pos.z as i32
|
||||
);
|
||||
}
|
||||
Command::BotStatus => {
|
||||
let bot_status = state.bot_status.lock().unwrap().to_owned();
|
||||
let metadata = client.metadata();
|
||||
|
Loading…
x
Reference in New Issue
Block a user