diff --git a/Cargo.toml b/Cargo.toml index 30d3580..4dba66d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ serde = { version = "1.0.101", features = ["derive"] } rand = "0.6" typemap = "0.3" chrono = "0.4" +num-format = "0.4" [profile.release] codegen-units = 1 diff --git a/src/commands/runescape.rs b/src/commands/runescape.rs index 769f65e..56e5c84 100644 --- a/src/commands/runescape.rs +++ b/src/commands/runescape.rs @@ -3,6 +3,7 @@ use serenity::{ framework::standard::{macros::command, Args, CommandResult}, model::channel::Message, }; +use num_format::{Locale, ToFormattedString}; #[command] #[description = "echos the message given"] @@ -31,7 +32,7 @@ pub fn profile(ctx: &mut Context, msg: &Message, args: Args) -> CommandResult { profile.questsstarted, profile.rank.clone().unwrap_or("none".to_string()), profile.totalskill, - profile.totalxp, + profile.totalxp.to_formatted_string(&Locale::en), profile.combatlevel ); let mut stats_extended: Vec = profile @@ -41,7 +42,7 @@ pub fn profile(ctx: &mut Context, msg: &Message, args: Args) -> CommandResult { .collect(); stats_extended.sort_by(|s1, s2| ORDER[s1.id as usize].cmp(&ORDER[s2.id as usize])); let mut left = String::new(); - for i in 0..27 { + for i in 0..28 { if i % 3 == 0 { left.push('\n') } @@ -128,7 +129,7 @@ impl std::convert::From<&SkillValue> for SkillValueExtended { } } -static SKILL_NAMES: [&'static str; 27] = [ +static SKILL_NAMES: [&'static str; 28] = [ "Attack", "Defence", "Strength", @@ -156,14 +157,15 @@ static SKILL_NAMES: [&'static str; 27] = [ "Dungeoneering", "Divination", "Invention", + "Archeology" ]; -static ORDER: [u32; 27] = [ +static ORDER: [u32; 28] = [ 1, 7, 4, 2, 10, 13, 16, 12, 18, 17, 9, 15, 14, 6, 3, 8, 5, 11, 20, 21, 19, 23, 22, 24, 25, 26, - 27, + 27, 28 ]; -static EMOJIS: [&'static str; 27] = [ +static EMOJIS: [&'static str; 28] = [ "<:Attack:406361343223136256>", "<:Defence:406361343348834304>", "<:Strength:406361343357222914>", @@ -191,4 +193,5 @@ static EMOJIS: [&'static str; 27] = [ "<:Dungeoneering:406361343386451979>", "<:Divination:406361343374131211>", "<:Invention:406361343591972864>", + "<:Archeology:713541764874764289>" ];