Small fixes
continuous-integration/woodpecker the build was successful
Details
continuous-integration/woodpecker the build was successful
Details
+ Improved location format + Added an error message for invalid link codes + Clippy + fmtmain
parent
6bc80af865
commit
99a78599c7
|
@ -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<String> {
|
||||
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())
|
||||
|
|
|
@ -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.";
|
||||
|
|
|
@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue