diff --git a/geoffrey_bot/src/bot/commands/register.rs b/geoffrey_bot/src/bot/commands/register.rs index 984c907..007b478 100644 --- a/geoffrey_bot/src/bot/commands/register.rs +++ b/geoffrey_bot/src/bot/commands/register.rs @@ -9,6 +9,8 @@ use crate::bot::commands::{BotCommand, CommandError}; use geoffrey_models::models::parameters::register_params::RegisterParameters; use geoffrey_models::models::player::{Player, UserID}; use serenity::builder::CreateApplicationCommand; +use geoffrey_models::models::response::api_error::GeoffreyAPIError; +use crate::bot::lang::ACCOUNT_LINK_INVALID; pub struct RegisterCommand; @@ -25,6 +27,15 @@ impl BotCommand for RegisterCommand { Method::POST } + fn custom_err_resp(err: &CommandError) -> Option { + match err { + CommandError::GeoffreyApi(GeoffreyAPIError::AccountLinkInvalid) => { + Some(ACCOUNT_LINK_INVALID.to_string()) + } + _ => None + } + } + fn create_app_command(command: &mut CreateApplicationCommand) -> &mut CreateApplicationCommand { command .name(Self::command_name()) diff --git a/geoffrey_bot/src/bot/lang.rs b/geoffrey_bot/src/bot/lang.rs index 722718d..23499dc 100644 --- a/geoffrey_bot/src/bot/lang.rs +++ b/geoffrey_bot/src/bot/lang.rs @@ -4,3 +4,4 @@ pub const PLAYER_DOES_NOT_HAVE_MATCHING_SHOP: &str = "You don't have a shop by that name, try again champ."; pub const PLAYER_ALREADY_SELLS_ITEM: &str = "You already sell that ding dong"; pub const NO_LOCATION_FOUND: &str = "No location found by that name goober"; +pub const ACCOUNT_LINK_INVALID: &str = "Your link code is invalid. You may need a new one. Or to git gud."; diff --git a/geoffrey_models/src/models/mod.rs b/geoffrey_models/src/models/mod.rs index 0745546..a52e059 100644 --- a/geoffrey_models/src/models/mod.rs +++ b/geoffrey_models/src/models/mod.rs @@ -89,8 +89,8 @@ impl Display for Position { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { write!( f, - "(x={}, y={}, z={}) {} ", - self.x, self.y, self.z, self.dimension + "({} x={}, y={}, z={}) ", + self.dimension ,self.x, self.y, self.z ) } }