Clippy is now Happy
This commit is contained in:
parent
5c5fcc0749
commit
4cc3acc737
9 changed files with 67 additions and 94 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -800,7 +800,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "obsessed-yanqing"
|
name = "obsessed-yanqing"
|
||||||
version = "1.1.1"
|
version = "1.1.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"levenshtein",
|
"levenshtein",
|
||||||
"poise",
|
"poise",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "obsessed-yanqing"
|
name = "obsessed-yanqing"
|
||||||
version = "1.1.2"
|
version = "1.1.3"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["Evann Regnault"]
|
authors = ["Evann Regnault"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
|
@ -10,7 +10,7 @@ use crate::data::allcharacters::{Characters, get_nearest_characters};
|
||||||
use crate::data::character::{Character, get_character_data};
|
use crate::data::character::{Character, get_character_data};
|
||||||
use crate::data::cones::get_light_cone;
|
use crate::data::cones::get_light_cone;
|
||||||
use crate::data::description::get_all_texts;
|
use crate::data::description::get_all_texts;
|
||||||
use crate::data::proscons::get_proscons_texts;
|
use crate::data::proscons::{format_proscons};
|
||||||
use crate::utils::color_manager::get_element_color;
|
use crate::utils::color_manager::get_element_color;
|
||||||
use crate::utils::emote_manager::{get_element_emote, get_path_emote};
|
use crate::utils::emote_manager::{get_element_emote, get_path_emote};
|
||||||
|
|
||||||
|
@ -21,6 +21,18 @@ enum CharacterTab {
|
||||||
Team
|
Team
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get_base_character_embed(character: &Character) -> CreateEmbed {
|
||||||
|
CreateEmbed::default()
|
||||||
|
.title(format!("{} {} {}", get_element_emote(&character.element), character.name, get_path_emote(&character.path)))
|
||||||
|
.set_footer(CreateEmbedFooter::default().text("Data from https://www.prydwen.gg/").to_owned())
|
||||||
|
.description(format!("{}\n{}\n",
|
||||||
|
":star:".repeat(character.rarity.parse().unwrap_or(4)),
|
||||||
|
character.default_role))
|
||||||
|
.color(get_element_color(&character.element))
|
||||||
|
.thumbnail(format!("https://www.prydwen.gg{}", character.small_image.local_file.child_image_sharp.gatsby_image_data.images.fallback.src))
|
||||||
|
.to_owned()
|
||||||
|
}
|
||||||
|
|
||||||
async fn create_menu(ctx: Context<'_>, chars: Vec<Characters>) -> ReplyHandle {
|
async fn create_menu(ctx: Context<'_>, chars: Vec<Characters>) -> ReplyHandle {
|
||||||
ctx.send(|a| {
|
ctx.send(|a| {
|
||||||
a.content("Select the right character").components(|c| {
|
a.content("Select the right character").components(|c| {
|
||||||
|
@ -54,49 +66,20 @@ async fn get_character_home(character: &Character) -> Option<CreateEmbed> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Some(
|
Some(
|
||||||
CreateEmbed::default()
|
get_base_character_embed(character)
|
||||||
.title(format!("{} {} {}", get_element_emote(&character.element), character.name, get_path_emote(&character.path)))
|
|
||||||
.set_footer(CreateEmbedFooter::default().text("Data from https://www.prydwen.gg/").to_owned())
|
|
||||||
.description(format!("{}\n{}\n\n{}",
|
.description(format!("{}\n{}\n\n{}",
|
||||||
":star:".repeat(character.rarity.parse().unwrap_or(4)),
|
":star:".repeat(character.rarity.parse().unwrap_or(4)),
|
||||||
character.default_role,
|
character.default_role,
|
||||||
desc))
|
desc))
|
||||||
.color(get_element_color(&character.element))
|
|
||||||
.thumbnail(format!("https://www.prydwen.gg{}", character.small_image.local_file.child_image_sharp.gatsby_image_data.images.fallback.src))
|
|
||||||
.to_owned()
|
.to_owned()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_character_review(character: &Character) -> Option<CreateEmbed> {
|
async fn get_character_review(character: &Character) -> Option<CreateEmbed> {
|
||||||
let cons_data = &character.cons;
|
|
||||||
let cons = match cons_data {
|
|
||||||
None => { "".to_string() }
|
|
||||||
Some(data) => {
|
|
||||||
let all_texts: Vec<String> = get_proscons_texts(&data).unwrap_or(vec![]).into_iter().map(|x| format!("• {}", x)).collect();
|
|
||||||
all_texts.join("\n")
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
let pros_data = &character.pros;
|
|
||||||
let pros = match pros_data {
|
|
||||||
None => { "".to_string() }
|
|
||||||
Some(data) => {
|
|
||||||
let all_texts: Vec<String> = get_proscons_texts(&data).unwrap_or(vec![]).into_iter().map(|x| format!("• {}", x)).collect();
|
|
||||||
all_texts.join("\n")
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Some(
|
Some(
|
||||||
CreateEmbed::default()
|
get_base_character_embed(character)
|
||||||
.title(format!("{} {} {}", get_element_emote(&character.element), character.name, get_path_emote(&character.path)))
|
.field(":green_circle: Pros", format_proscons( &character.pros), false)
|
||||||
.set_footer(CreateEmbedFooter::default().text("Data from https://www.prydwen.gg/").to_owned())
|
.field(":red_circle: Cons", format_proscons( &character.cons), false)
|
||||||
.description(format!("{}\n{}",
|
|
||||||
":star:".repeat(character.rarity.parse().unwrap_or(4)),
|
|
||||||
character.default_role))
|
|
||||||
.field(":green_circle: Pros", pros, false)
|
|
||||||
.field(":red_circle: Cons", cons, false)
|
|
||||||
.color(get_element_color(&character.element))
|
|
||||||
.thumbnail(format!("https://www.prydwen.gg{}", character.small_image.local_file.child_image_sharp.gatsby_image_data.images.fallback.src))
|
|
||||||
.to_owned()
|
.to_owned()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -108,13 +91,8 @@ async fn get_character_build(character: &Character, index: usize) -> Option<Crea
|
||||||
let light_cones = join_all(clone.cones.into_iter().map(|c| async { (c.super_field ,get_light_cone(c.cone).await.expect("Cone"))})).await;
|
let light_cones = join_all(clone.cones.into_iter().map(|c| async { (c.super_field ,get_light_cone(c.cone).await.expect("Cone"))})).await;
|
||||||
|
|
||||||
Some(
|
Some(
|
||||||
CreateEmbed::default()
|
get_base_character_embed(character)
|
||||||
.title(format!("{} {} {}", get_element_emote(&character.element), character.name, get_path_emote(&character.path)))
|
.field(chosen_build.name.as_str(), chosen_build.comments.as_str(), false)
|
||||||
.set_footer(CreateEmbedFooter::default().text("Data from https://www.prydwen.gg/").to_owned())
|
|
||||||
.description(format!("{}\n{}",
|
|
||||||
":star:".repeat(character.rarity.parse().unwrap_or(4)),
|
|
||||||
character.default_role))
|
|
||||||
.field(&chosen_build.name.as_str(), &chosen_build.comments.as_str(), false)
|
|
||||||
|
|
||||||
|
|
||||||
// STUFF
|
// STUFF
|
||||||
|
@ -129,11 +107,11 @@ async fn get_character_build(character: &Character, index: usize) -> Option<Crea
|
||||||
|
|
||||||
|
|
||||||
// STATS
|
// STATS
|
||||||
.field("Body", chosen_build.body.iter().map(|f| format!("{}",f.stat)).collect::<Vec<String>>().join(" / "), true)
|
.field("Body", chosen_build.body.iter().map(|f| f.stat.to_string()).collect::<Vec<String>>().join(" / "), true)
|
||||||
.field("Feet", chosen_build.feet.iter().map(|f| format!("{}",f.stat)).collect::<Vec<String>>().join(" / "), true)
|
.field("Feet", chosen_build.feet.iter().map(|f| f.stat.to_string()).collect::<Vec<String>>().join(" / "), true)
|
||||||
.field("\u{200B}", "\u{200B}", true)
|
.field("\u{200B}", "\u{200B}", true)
|
||||||
.field("Planar Sphere", chosen_build.sphere.iter().map(|f| format!("{}",f.stat)).collect::<Vec<String>>().join(" / "), true)
|
.field("Planar Sphere", chosen_build.sphere.iter().map(|f| f.stat.to_string()).collect::<Vec<String>>().join(" / "), true)
|
||||||
.field("Link Rope", chosen_build.rope.iter().map(|f| format!("{}",f.stat)).collect::<Vec<String>>().join(" / "), true)
|
.field("Link Rope", chosen_build.rope.iter().map(|f| f.stat.to_string()).collect::<Vec<String>>().join(" / "), true)
|
||||||
.field("\u{200B}", "\u{200B}", true)
|
.field("\u{200B}", "\u{200B}", true)
|
||||||
|
|
||||||
.field("Substats", &chosen_build.substats, false)
|
.field("Substats", &chosen_build.substats, false)
|
||||||
|
@ -142,8 +120,6 @@ async fn get_character_build(character: &Character, index: usize) -> Option<Crea
|
||||||
.field("Skill Priority", &chosen_build.skill_priority, false)
|
.field("Skill Priority", &chosen_build.skill_priority, false)
|
||||||
.field("Major Traces Priority", &chosen_build.traces_priority, false)
|
.field("Major Traces Priority", &chosen_build.traces_priority, false)
|
||||||
|
|
||||||
.color(get_element_color(&character.element))
|
|
||||||
.thumbnail(format!("https://www.prydwen.gg{}", character.small_image.local_file.child_image_sharp.gatsby_image_data.images.fallback.src))
|
|
||||||
.to_owned()
|
.to_owned()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -157,26 +133,18 @@ async fn get_character_team(character: &Character) -> Option<CreateEmbed> {
|
||||||
member_4: Character
|
member_4: Character
|
||||||
}
|
}
|
||||||
|
|
||||||
let teams = join_all(character.teams.as_ref().expect("No teams").into_iter().map(|team| async move {
|
let teams = join_all(character.teams.as_ref().expect("No teams").iter().map(|team| async move {
|
||||||
Team {
|
Team {
|
||||||
name: team.name.clone(),
|
name: team.name.clone(),
|
||||||
member_1: get_character_data(team.member_1.clone()).await.expect(format!("{} doesn't exist", team.member_1).as_str()),
|
member_1: get_character_data(team.member_1.clone()).await.unwrap_or_else(|| panic!("{} doesn't exist", team.member_1)),
|
||||||
member_2: get_character_data(team.member_2.clone()).await.expect(format!("{} doesn't exist", team.member_2).as_str()),
|
member_2: get_character_data(team.member_2.clone()).await.unwrap_or_else(|| panic!("{} doesn't exist", team.member_2)),
|
||||||
member_3: get_character_data(team.member_3.clone()).await.expect(format!("{} doesn't exist", team.member_3).as_str()),
|
member_3: get_character_data(team.member_3.clone()).await.unwrap_or_else(|| panic!("{} doesn't exist", team.member_3)),
|
||||||
member_4: get_character_data(team.member_4.clone()).await.expect(format!("{} doesn't exist", team.member_4).as_str())
|
member_4: get_character_data(team.member_4.clone()).await.unwrap_or_else(|| panic!("{} doesn't exist", team.member_4))
|
||||||
}
|
}
|
||||||
})).await;
|
})).await;
|
||||||
|
|
||||||
Some(
|
Some(
|
||||||
CreateEmbed::default()
|
get_base_character_embed(character)
|
||||||
.title(format!("{} {} {}", get_element_emote(&character.element), character.name, get_path_emote(&character.path)))
|
|
||||||
.set_footer(CreateEmbedFooter::default().text("Data from https://www.prydwen.gg/").to_owned())
|
|
||||||
.description(format!("{}\n{}\n",
|
|
||||||
":star:".repeat(character.rarity.parse().unwrap_or(4)),
|
|
||||||
character.default_role))
|
|
||||||
|
|
||||||
.color(get_element_color(&character.element))
|
|
||||||
.thumbnail(format!("https://www.prydwen.gg{}", character.small_image.local_file.child_image_sharp.gatsby_image_data.images.fallback.src))
|
|
||||||
.fields(teams.into_iter().map(|team| {
|
.fields(teams.into_iter().map(|team| {
|
||||||
(team.name, format!("{} / {} / {} / {}", team.member_1.name, team.member_2.name, team.member_3.name, team.member_4.name), false)
|
(team.name, format!("{} / {} / {} / {}", team.member_1.name, team.member_2.name, team.member_3.name, team.member_4.name), false)
|
||||||
}))
|
}))
|
||||||
|
@ -293,21 +261,18 @@ async fn menu_handler(ctx: Context<'_>, interaction: Arc<MessageComponentInterac
|
||||||
};
|
};
|
||||||
match looping {
|
match looping {
|
||||||
true => {
|
true => {
|
||||||
match interaction
|
interaction.edit_original_interaction_response(&ctx, |d| {
|
||||||
.edit_original_interaction_response(&ctx, |d| {
|
|
||||||
match character_embed {
|
match character_embed {
|
||||||
None => {}
|
None => {}
|
||||||
Some(_) => { d.set_embed(character_embed.unwrap()); }
|
Some(_) => { d.set_embed(character_embed.unwrap()); }
|
||||||
}
|
}
|
||||||
d.content("");
|
d.content("");
|
||||||
d.components(|f| create_character_tabs_button(&mut *f, &character, &tab))
|
d.components(|f| create_character_tabs_button(&mut *f, &character, &tab))
|
||||||
}).await {
|
}).await.expect("Cannot edit interaction message");
|
||||||
Ok(_) => {}
|
|
||||||
Err(_) => {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
false => {
|
false => {
|
||||||
match interaction
|
if (interaction
|
||||||
.create_interaction_response(&ctx, |r| {
|
.create_interaction_response(&ctx, |r| {
|
||||||
r.interaction_response_data(|d| {
|
r.interaction_response_data(|d| {
|
||||||
match character_embed {
|
match character_embed {
|
||||||
|
@ -318,10 +283,7 @@ async fn menu_handler(ctx: Context<'_>, interaction: Arc<MessageComponentInterac
|
||||||
d.ephemeral(true);
|
d.ephemeral(true);
|
||||||
d.components(|f| create_character_tabs_button(&mut *f, &character, &tab))
|
d.components(|f| create_character_tabs_button(&mut *f, &character, &tab))
|
||||||
})
|
})
|
||||||
}).await {
|
}).await).is_ok() { interaction.delete_followup_message(&ctx, interaction.message.id).await.unwrap(); }
|
||||||
Ok(_) => { interaction.delete_followup_message(&ctx, interaction.message.id).await.unwrap(); }
|
|
||||||
Err(_) => {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,7 +292,7 @@ async fn menu_handler(ctx: Context<'_>, interaction: Arc<MessageComponentInterac
|
||||||
Err(_) => return
|
Err(_) => return
|
||||||
};
|
};
|
||||||
|
|
||||||
let x = x.await_component_interaction(&ctx).timeout(Duration::from_secs(10 * 60)).await;
|
let x = x.await_component_interaction(ctx).timeout(Duration::from_secs(10 * 60)).await;
|
||||||
|
|
||||||
match x {
|
match x {
|
||||||
None => {}
|
None => {}
|
||||||
|
@ -357,7 +319,7 @@ async fn menu_handler(ctx: Context<'_>, interaction: Arc<MessageComponentInterac
|
||||||
async fn choice_interaction_handler(ctx: Context<'_>, message: &ReplyHandle<'_>) {
|
async fn choice_interaction_handler(ctx: Context<'_>, message: &ReplyHandle<'_>) {
|
||||||
let message = message.clone().into_message().await.unwrap();
|
let message = message.clone().into_message().await.unwrap();
|
||||||
let interaction =
|
let interaction =
|
||||||
match message.await_component_interaction(&ctx).timeout(Duration::from_secs(60 * 3)).await {
|
match message.await_component_interaction(ctx).timeout(Duration::from_secs(60 * 3)).await {
|
||||||
Some(x) => {
|
Some(x) => {
|
||||||
x
|
x
|
||||||
}
|
}
|
||||||
|
@ -389,7 +351,7 @@ pub async fn character(
|
||||||
#[description = "Character to Search"] user: String,
|
#[description = "Character to Search"] user: String,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
match get_nearest_characters(user).await {
|
match get_nearest_characters(user).await {
|
||||||
None => { ctx.say(format!("Error occured, please see logs")).await? }
|
None => { ctx.say("Error occurred, please see logs".to_string()).await? }
|
||||||
Some(characters) => {
|
Some(characters) => {
|
||||||
let handler = create_menu(ctx, characters).await;
|
let handler = create_menu(ctx, characters).await;
|
||||||
choice_interaction_handler(ctx, &handler).await;
|
choice_interaction_handler(ctx, &handler).await;
|
||||||
|
|
|
@ -36,14 +36,14 @@ pub async fn get_nearest_characters(name: String) -> Option<Vec<Characters>> {
|
||||||
match a.name.to_lowercase().contains(name.to_lowercase().as_str()) {
|
match a.name.to_lowercase().contains(name.to_lowercase().as_str()) {
|
||||||
true => {
|
true => {
|
||||||
match b.name.to_lowercase().contains(name.to_lowercase().as_str()) {
|
match b.name.to_lowercase().contains(name.to_lowercase().as_str()) {
|
||||||
true => return Ordering::Equal,
|
true => Ordering::Equal,
|
||||||
false => return Ordering::Less
|
false => Ordering::Less
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
false => {
|
false => {
|
||||||
match b.name.to_lowercase().contains(name.to_lowercase().as_str()){
|
match b.name.to_lowercase().contains(name.to_lowercase().as_str()){
|
||||||
true => return Ordering::Greater,
|
true => Ordering::Greater,
|
||||||
false => return levenshtein(a.name.to_lowercase().as_str(), name.to_lowercase().as_str()).partial_cmp(&levenshtein(b.name.to_lowercase().as_str(), name.to_lowercase().as_str())).unwrap()
|
false => levenshtein(a.name.to_lowercase().as_str(), name.to_lowercase().as_str()).partial_cmp(&levenshtein(b.name.to_lowercase().as_str(), name.to_lowercase().as_str())).unwrap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -240,7 +240,7 @@ pub async fn get_light_cone(name: String) -> Option<Cone> {
|
||||||
let data : Result<PrydwenResponse<PrydwenCone>, _> = serde_path_to_error::deserialize(js);
|
let data : Result<PrydwenResponse<PrydwenCone>, _> = serde_path_to_error::deserialize(js);
|
||||||
match data {
|
match data {
|
||||||
Ok(d) => {
|
Ok(d) => {
|
||||||
Some(d.result.data.all_characters.nodes.into_iter().filter(|f| f.slug.eq(name.as_str())).collect::<Vec<Cone>>().get(0).expect(format!("Cannot find {}", name).as_str()).clone())
|
Some(d.result.data.all_characters.nodes.into_iter().filter(|f| f.slug.eq(name.as_str())).collect::<Vec<Cone>>().get(0).unwrap_or_else(|| panic!("Cannot find {}", name)).clone())
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
let path = err.path().to_string();
|
let path = err.path().to_string();
|
||||||
|
|
|
@ -66,7 +66,7 @@ pub fn get_all_texts<T:RawText>(desc: &T) -> Option<Vec<String>> {
|
||||||
let data : Result<Root, _> = serde_path_to_error::deserialize(js);
|
let data : Result<Root, _> = serde_path_to_error::deserialize(js);
|
||||||
match data {
|
match data {
|
||||||
Ok(d) => {
|
Ok(d) => {
|
||||||
Some(d.content.into_iter().map(|x| x.content.into_iter().map(|y| y.value)).flatten().collect())
|
Some(d.content.into_iter().flat_map(|x| x.content.into_iter().map(|y| y.value)).collect())
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
let path = err.path().to_string();
|
let path = err.path().to_string();
|
||||||
|
|
|
@ -58,13 +58,13 @@ pub trait ProsCons {
|
||||||
fn get_raw(&self) -> &str;
|
fn get_raw(&self) -> &str;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ProsCons for &Cons {
|
impl ProsCons for Cons {
|
||||||
fn get_raw(&self) -> &str {
|
fn get_raw(&self) -> &str {
|
||||||
self.raw.as_str()
|
self.raw.as_str()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ProsCons for &Pros {
|
impl ProsCons for Pros {
|
||||||
fn get_raw(&self) -> &str {
|
fn get_raw(&self) -> &str {
|
||||||
self.raw.as_str()
|
self.raw.as_str()
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ pub fn get_proscons_texts<T:ProsCons>(desc: &T) -> Option<Vec<String>> {
|
||||||
let data : Result<Root, _> = serde_path_to_error::deserialize(js);
|
let data : Result<Root, _> = serde_path_to_error::deserialize(js);
|
||||||
match data {
|
match data {
|
||||||
Ok(d) => {
|
Ok(d) => {
|
||||||
Some(d.content.into_iter().map(|x| x.content.into_iter().map(|y| y.content.into_iter().map(|z| z.content.into_iter().map(|w| w.value)).flatten()).flatten()).flatten().collect())
|
Some(d.content.into_iter().flat_map(|x| x.content.into_iter().flat_map(|y| y.content.into_iter().flat_map(|z| z.content.into_iter().map(|w| w.value)))).collect())
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
let path = err.path().to_string();
|
let path = err.path().to_string();
|
||||||
|
@ -85,3 +85,14 @@ pub fn get_proscons_texts<T:ProsCons>(desc: &T) -> Option<Vec<String>> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
pub fn format_proscons<T:ProsCons>(proscons : &Option<T>) -> String {
|
||||||
|
match proscons {
|
||||||
|
None => { "".to_string() }
|
||||||
|
Some(data) => {
|
||||||
|
let all_texts: Vec<String> = get_proscons_texts(data).unwrap_or(vec![]).into_iter().map(|x| format!("• {}", x)).collect();
|
||||||
|
all_texts.join("\n")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use serenity::utils::Color;
|
use serenity::utils::Color;
|
||||||
|
|
||||||
pub fn get_element_color(name: &String) -> Color {
|
pub fn get_element_color(name: &str) -> Color {
|
||||||
let mut color_map = HashMap::new();
|
let mut color_map = HashMap::new();
|
||||||
color_map.insert("Physical", Color::new(9934743));
|
color_map.insert("Physical", Color::new(9934743));
|
||||||
color_map.insert("Fire", Color::new(15615805));
|
color_map.insert("Fire", Color::new(15615805));
|
||||||
|
@ -10,11 +10,11 @@ pub fn get_element_color(name: &String) -> Color {
|
||||||
color_map.insert("Wind", Color::new(6410131));
|
color_map.insert("Wind", Color::new(6410131));
|
||||||
color_map.insert("Quantum", Color::new(6313929));
|
color_map.insert("Quantum", Color::new(6313929));
|
||||||
color_map.insert("Imaginary", Color::new(15982903));
|
color_map.insert("Imaginary", Color::new(15982903));
|
||||||
color_map.get(name.as_str()).unwrap_or(&Color::new(0)).to_owned()
|
color_map.get(name).unwrap_or(&Color::new(0)).to_owned()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub fn get_path_color(name: &String) -> Color {
|
pub fn get_path_color(name: &str) -> Color {
|
||||||
let mut color_map = HashMap::new();
|
let mut color_map = HashMap::new();
|
||||||
color_map.insert("Abundance", Color::new(6410131));
|
color_map.insert("Abundance", Color::new(6410131));
|
||||||
color_map.insert("Destruction", Color::new(9934743));
|
color_map.insert("Destruction", Color::new(9934743));
|
||||||
|
@ -23,5 +23,5 @@ pub fn get_path_color(name: &String) -> Color {
|
||||||
color_map.insert("Hunt", Color::new(15615805));
|
color_map.insert("Hunt", Color::new(15615805));
|
||||||
color_map.insert("Nihility", Color::new(6313929));
|
color_map.insert("Nihility", Color::new(6313929));
|
||||||
color_map.insert("Preservation", Color::new(15982903));
|
color_map.insert("Preservation", Color::new(15982903));
|
||||||
color_map.get(name.as_str()).unwrap_or(&Color::new(0)).to_owned()
|
color_map.get(name).unwrap_or(&Color::new(0)).to_owned()
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
pub fn get_element_emote(name: &String) -> &'static str {
|
pub fn get_element_emote(name: &str) -> &'static str {
|
||||||
let mut emote_map = HashMap::new();
|
let mut emote_map = HashMap::new();
|
||||||
emote_map.insert("Physical", "<:ele_physical:1102553011928186901>");
|
emote_map.insert("Physical", "<:ele_physical:1102553011928186901>");
|
||||||
emote_map.insert("Fire", "<:ele_fire:1102553084523196470>");
|
emote_map.insert("Fire", "<:ele_fire:1102553084523196470>");
|
||||||
|
@ -9,10 +9,10 @@ pub fn get_element_emote(name: &String) -> &'static str {
|
||||||
emote_map.insert("Wind", "<:ele_wind:1102553253733998643>");
|
emote_map.insert("Wind", "<:ele_wind:1102553253733998643>");
|
||||||
emote_map.insert("Quantum", "<:ele_quantum:1102553252278583326>");
|
emote_map.insert("Quantum", "<:ele_quantum:1102553252278583326>");
|
||||||
emote_map.insert("Imaginary", "<:ele_imaginary:1102551584057069649>");
|
emote_map.insert("Imaginary", "<:ele_imaginary:1102551584057069649>");
|
||||||
emote_map.get(name.as_str()).unwrap_or(&"").to_owned()
|
emote_map.get(name).unwrap_or(&"").to_owned()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_path_emote(name: &String) -> &'static str {
|
pub fn get_path_emote(name: &str) -> &'static str {
|
||||||
let mut emote_map = HashMap::new();
|
let mut emote_map = HashMap::new();
|
||||||
emote_map.insert("Abundance", "<:path_abundance:1102554507986088038>");
|
emote_map.insert("Abundance", "<:path_abundance:1102554507986088038>");
|
||||||
emote_map.insert("Destruction", "<:path_destruction:1102554505511448646>");
|
emote_map.insert("Destruction", "<:path_destruction:1102554505511448646>");
|
||||||
|
@ -21,5 +21,5 @@ pub fn get_path_emote(name: &String) -> &'static str {
|
||||||
emote_map.insert("Hunt", "<:path_hunt:1102554500352458812>");
|
emote_map.insert("Hunt", "<:path_hunt:1102554500352458812>");
|
||||||
emote_map.insert("Nihility", "<:path_nihility:1102554499085778964>");
|
emote_map.insert("Nihility", "<:path_nihility:1102554499085778964>");
|
||||||
emote_map.insert("Preservation", "<:path_preservation:1102554496757927968>");
|
emote_map.insert("Preservation", "<:path_preservation:1102554496757927968>");
|
||||||
emote_map.get(name.as_str()).unwrap_or(&"").to_owned()
|
emote_map.get(name).unwrap_or(&"").to_owned()
|
||||||
}
|
}
|
Loading…
Reference in a new issue