Fixed currency in sent messages

This commit is contained in:
Joan
2023-07-04 14:13:15 +02:00
parent 63c9de8e1b
commit cb7b8c8db7

View File

@@ -130,7 +130,11 @@ async def send_article(article, product):
description = f"*📝 Descripción*: {telegram_escape_characters(article['description'])}" description = f"*📝 Descripción*: {telegram_escape_characters(article['description'])}"
found_by = f"*🔍 Encontrado por la búsqueda de:* {telegram_escape_characters(product['product_name'])}" 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))}" 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}" 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" #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')} #files = {'photo':open(f"/app/data/images/products/{article['id']}_composed.png", 'rb')}