Add fulfilment info to bot

This commit is contained in:
SkyfallWasTaken 2024-07-20 13:24:29 +01:00
parent 75e1fff074
commit 5a27d3f38c

View file

@ -59,10 +59,12 @@ pub fn format_new_item(item: &ShopItem) -> String {
formatdoc! { formatdoc! {
"*New item added:* {full_name} "*New item added:* {full_name}
*Description:* {description} *Description:* {description}
*Fulfillment info:* {fullfilment_info}
*Price:* {price} *Price:* {price}
*Stock:* {stock}", *Stock:* {stock}",
full_name = item.full_name, full_name = item.full_name,
description = item.description.as_ref().unwrap_or(&"_not set_".into()), description = item.description.as_ref().unwrap_or(&"_not set_".into()),
fullfilment_info = item.fulfillment_description.as_ref().unwrap_or(&"_not set_".into()),
price = item.price, price = item.price,
stock = item.stock stock = item.stock
.map(|stock| stock.to_string()) .map(|stock| stock.to_string())
@ -92,6 +94,7 @@ mod format_new_tests {
let item = ShopItem { let item = ShopItem {
full_name: "Test".into(), full_name: "Test".into(),
description: Some("Lorem ipsum".into()), description: Some("Lorem ipsum".into()),
fulfillment_description: Some("Dolor sit amet".into()),
price: 1, price: 1,
stock: Some(10), stock: Some(10),
..Default::default() ..Default::default()
@ -102,6 +105,7 @@ mod format_new_tests {
indoc! {" indoc! {"
*New item added:* Test *New item added:* Test
*Description:* Lorem ipsum *Description:* Lorem ipsum
*Fulfillment info:* Dolor sit amet
*Price:* 1 *Price:* 1
*Stock:* 10"} *Stock:* 10"}
); );