Skip to content

Commit

Permalink
0.8.3 - Pearl Location
Browse files Browse the repository at this point in the history
  • Loading branch information
ShayBox committed Nov 29, 2024
1 parent c9ae15c commit 81538ce
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "shaysbot"
version = "0.8.2"
version = "0.8.3"
authors = ["Shayne Hartford <shaybox@shaybox.com>"]
edition = "2021"
description = "My personal Minecraft bot using Azalea"
Expand Down
21 changes: 12 additions & 9 deletions src/commands/pearl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub fn handle_pearl_command_event(
};

whisper_event.content = format!(
"[404] Invalid or Missing location, Available location(s): {}",
"[404] Invalid location, Available locations: {}",
settings
.locations
.keys()
Expand Down Expand Up @@ -121,19 +121,22 @@ pub fn handle_pearl_command_event(

let (alias, bot) = match event.args.pop_front() {
Some(alias) => match settings.locations.get_key_value(&alias) {
Some((alias, bot_settings)) if bot_settings.account_username == profile.name => {
(alias, bot_settings)
}
Some(l) if l.1.account_username == profile.name => l,
Some(_) => {
whisper_event.content = str!("[500] I'm not at that location");
whisper_events.send(whisper_event);
continue;
}
_ => {
whisper_events.send(whisper_event);
command_events.clear();
return;
}
_ => match event.source {
CommandSource::Minecraft(_) if settings.locations.len() == 1 => {
settings.locations.iter().next().unwrap()
}
_ => {
whisper_events.send(whisper_event);
command_events.clear();
return;
}
},
},
None => match event.source {
CommandSource::Discord(_) => match settings.locations.iter().next() {
Expand Down
6 changes: 3 additions & 3 deletions src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub struct Settings {

/// Minecraft bot accounts
#[default(HashMap::from([
(str!("primary"), BotSettings::new(str!("Test"))),
(str!("primary"), BotSettings::new(str!("ShaysBot"))),
#[cfg(debug_assertions)]
(str!("secondary"), BotSettings::new(str!("Fishdar"))),
]))]
Expand Down Expand Up @@ -91,7 +91,7 @@ pub enum EncryptionMode {
}

#[serde_as]
#[derive(Clone, Component, Deserialize, Serialize, SmartDefault, New)]
#[derive(Clone, Component, Debug, Deserialize, Serialize, SmartDefault, New)]
#[serde(default)]
pub struct BotSettings {
/// Minecraft Online Mode.
Expand Down Expand Up @@ -124,7 +124,7 @@ pub struct BotSettings {
}

#[serde_as]
#[derive(Clone, Default, PartialEq, Deserialize, Serialize)]
#[derive(Clone, Debug, Default, PartialEq, Deserialize, Serialize)]
pub struct IdleGoal {
#[serde_as(as = "DisplayFromStr")]
pub coords: Vec3,
Expand Down

0 comments on commit 81538ce

Please sign in to comment.