diff --git a/src/telegram/display.rs b/src/telegram/display.rs
index 2979b17..e819148 100644
--- a/src/telegram/display.rs
+++ b/src/telegram/display.rs
@@ -2,7 +2,6 @@
//!
//! [Telegram Bot HTML]: https://core.telegram.org/bots/api#html-style
-use std::collections::HashMap;
use itertools::Itertools;
use teloxide::utils::html::escape;
use crate::data::setbundle::card::Card;
@@ -24,7 +23,7 @@ use crate::data::setbundle::supertype::CardSupertype;
pub fn display_card(card: &Card, globals: &LocalizedGlobalsIndexes) -> String {
let title = format!(
r#"{}"#,
- &card.main_art().card_png,
+ &card.main_art().expect("Card to have at least one illustration").card_png,
escape(&card.name),
);
@@ -52,6 +51,8 @@ pub fn display_card(card: &Card, globals: &LocalizedGlobalsIndexes) -> String {
let breadcrumbs = format!("{} › {} › {}", &set, ®ions, &r#type);
+ let keywords = display_keywords(&card.keywords, &globals.keywords);
+
let description = escape(&card.localized_description_text);
let flavor = format!(
@@ -61,7 +62,7 @@ pub fn display_card(card: &Card, globals: &LocalizedGlobalsIndexes) -> String {
let artist = format!(
r#"Illustration by {}"#,
- &card.main_art().full_png,
+ &card.main_art().expect("Card to have at least one illustration").full_png,
escape(&card.artist_name)
);
@@ -70,6 +71,7 @@ pub fn display_card(card: &Card, globals: &LocalizedGlobalsIndexes) -> String {
title=title,
stats=stats,
breadcrumbs=breadcrumbs,
+ keywords=keywords,
description=description,
flavor=flavor,
artist=artist,
@@ -121,7 +123,7 @@ fn display_types(r#type: &CardType, supertype: &CardSupertype, subtypes: &[CardS
result.push_str(&*format!(
"{}",
- escape(&String::from(r#type)),
+ escape(&*String::from(r#type)),
));
if subtypes.len() > 0 {
@@ -129,10 +131,7 @@ fn display_types(r#type: &CardType, supertype: &CardSupertype, subtypes: &[CardS
&*format!(
" › {}",
subtypes.iter()
- .map(|subtype| subtype
- .map(|o| format!("{}", escape(&o)))
- .unwrap_or_else(|| "Unknown".to_string())
- )
+ .map(|subtype| format!("{}", escape(&subtype)))
.join(", ")
)
)
diff --git a/src/telegram/mod.rs b/src/telegram/mod.rs
index 8754563..e8e0a0a 100644
--- a/src/telegram/mod.rs
+++ b/src/telegram/mod.rs
@@ -1 +1,5 @@
+//! Module providing utilities to be used in the [crate::bin::telegrambot].
+//!
+//! Remember while adding new features to this module that binaries [can only access the public API of the crate](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#binaries).
+
pub mod display;