fix autolink to use scryfall data type

This commit is contained in:
Adrian Malacoda 2018-05-06 03:55:14 -05:00
parent 1c870b58e4
commit 4e6d648d18

View File

@ -26,21 +26,27 @@ impl AutolinkModule {
} }
fn print_mtg_card (card: &MtgCard, message: &Message) { fn print_mtg_card (card: &MtgCard, message: &Message) {
message.reply(&format!("{}", card.image_url)); if let Some(ref image_uris) = card.image_uris {
if let Some(ref image_uri) = image_uris.get("normal") {
message.reply(&format!("{}", image_uri));
}
}
if let Some(ref cost) = card.cost { if let Some(ref cost) = card.mana_cost {
message.reply(&format!("**{}** (**{}**)", card.name, cost)); message.reply(&format!("**{}** (**{}**)", card.name, cost));
} else { } else {
message.reply(&format!("**{}**", card.name)); message.reply(&format!("**{}**", card.name));
} }
message.reply(&format!("**{}**", card.typeline)); if let Some(ref typeline) = card.type_line {
message.reply(&format!("**{}**", typeline));
}
if let Some(ref rules) = card.rules { if let Some(ref rules) = card.oracle_text {
message.reply(&format!("{}", rules)); message.reply(&format!("{}", rules));
} }
if let Some(ref flavor) = card.flavor { if let Some(ref flavor) = card.flavor_text {
message.reply(&format!("*{}*", flavor)); message.reply(&format!("*{}*", flavor));
} }