From cb7b8c8db701deeaf0291428e9a645c5497ceea9 Mon Sep 17 00:00:00 2001 From: Joan Date: Tue, 4 Jul 2023 14:13:15 +0200 Subject: [PATCH] Fixed currency in sent messages --- wallamanta/helpers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wallamanta/helpers.py b/wallamanta/helpers.py index 9fe0c18..ad19f31 100644 --- a/wallamanta/helpers.py +++ b/wallamanta/helpers.py @@ -130,7 +130,11 @@ async def send_article(article, product): description = f"*📝 Descripción*: {telegram_escape_characters(article['description'])}" found_by = f"*🔍 Encontrado por la búsqueda de:* {telegram_escape_characters(product['product_name'])}" created_at = f"*📅 Fecha de publicación:* {telegram_escape_characters(get_publish_date(article))}" - price = f"*💰 Precio*: {telegram_escape_characters(str(article['price']))} {telegram_escape_characters(article['currency'])}" + if article['currency'] == 'EUR': + currency = '€' + else: + currency = '?' + price = f"*💰 Precio*: {telegram_escape_characters(str(article['price']))} {telegram_escape_characters(currency)}" text = f"{title}\n\n{description}\n\n{found_by}\n\n{created_at}\n\n{price}" #url = f"https://api.telegram.org/bot{constants.TELEGRAM_TOKEN}/sendPhoto?chat_id={product['telegram_user_id']}&caption={text}&parse_mode=MarkdownV2" #files = {'photo':open(f"/app/data/images/products/{article['id']}_composed.png", 'rb')}