mirror of
https://github.com/Steffo99/patched-porobot.git
synced 2024-12-23 01:54:22 +00:00
Refactor Telegram card displaying
This commit is contained in:
parent
115af23e4b
commit
bbadb3b5ae
1 changed files with 7 additions and 17 deletions
|
@ -286,19 +286,19 @@ pub fn display_deck(index: &CardIndex, deck: &Deck, code: &str, name: &Option<&s
|
||||||
})
|
})
|
||||||
.join("\n");
|
.join("\n");
|
||||||
|
|
||||||
let mut tags: Vec<&'static str> = vec![];
|
let mut tags: Vec<String> = vec![];
|
||||||
|
|
||||||
let regions = if let Some(regions) = deck.standard(index) {
|
let regions = if let Some(regions) = deck.standard(index) {
|
||||||
tags.push("#Standard_4_5");
|
tags.push("#Standard_4_5".to_string());
|
||||||
regions
|
regions
|
||||||
} else if let Some(regions) = deck.eternal(index) {
|
} else if let Some(regions) = deck.eternal(index) {
|
||||||
tags.push("#Eternal");
|
tags.push("#Eternal".to_string());
|
||||||
regions
|
regions
|
||||||
} else if let Some(regions) = deck.unlimited_champions(index) {
|
} else if let Some(regions) = deck.unlimited_champions(index) {
|
||||||
tags.push("#UnlimitedChampions");
|
tags.push("#UnlimitedChampions".to_string());
|
||||||
regions
|
regions
|
||||||
} else if let Some(regions) = deck.singleton(index) {
|
} else if let Some(regions) = deck.singleton(index) {
|
||||||
tags.push("#Singleton");
|
tags.push("#Singleton".to_string());
|
||||||
regions
|
regions
|
||||||
} else {
|
} else {
|
||||||
HashSet::new()
|
HashSet::new()
|
||||||
|
@ -306,18 +306,8 @@ pub fn display_deck(index: &CardIndex, deck: &Deck, code: &str, name: &Option<&s
|
||||||
|
|
||||||
for region in regions {
|
for region in regions {
|
||||||
tags.push(match region {
|
tags.push(match region {
|
||||||
CardRegion::Noxus => "#Noxus",
|
CardRegion::Unsupported => "<i>Unknown</i>".to_string(),
|
||||||
CardRegion::Demacia => "#Demacia",
|
_ => format!("#{}", region.to_tag().map_or_else(|| "<i>Unknown</i>", |r| r)),
|
||||||
CardRegion::Freljord => "#Freljord",
|
|
||||||
CardRegion::ShadowIsles => "#ShadowIsles",
|
|
||||||
CardRegion::Targon => "#Targon",
|
|
||||||
CardRegion::Ionia => "#Ionia",
|
|
||||||
CardRegion::Bilgewater => "#Bilgewater",
|
|
||||||
CardRegion::Shurima => "#Shurima",
|
|
||||||
CardRegion::PiltoverZaun => "#PiltoverZaun",
|
|
||||||
CardRegion::BandleCity => "#BandleCity",
|
|
||||||
CardRegion::Runeterra => "#Runeterra",
|
|
||||||
CardRegion::Unsupported => "<i>Unknown</i>",
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue