From 7b00a89d07bea4885aa0a627e898361bc7822c09 Mon Sep 17 00:00:00 2001 From: Joan Date: Mon, 14 Aug 2023 22:15:33 +0200 Subject: [PATCH] Fixed reply_markup --- wallamanta/helpers.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wallamanta/helpers.py b/wallamanta/helpers.py index 2e10dcd..afa55b6 100644 --- a/wallamanta/helpers.py +++ b/wallamanta/helpers.py @@ -6,6 +6,7 @@ import constants import pytz import walladb import asyncio +import json from newrelic_telemetry_sdk import Event, EventClient from PIL import Image, ImageDraw, ImageFont @@ -166,6 +167,7 @@ def send_article(article, product): #keyboard = [[InlineKeyboardButton("Ir al anuncio", url=f"https://es.wallapop.com/item/{article['web_slug']}")]] #InlineKeyboardButton("Listar productos", callback_data="list")] #markup = InlineKeyboardMarkup(keyboard) + keyboard = {'inline_keyboard':[[{'text':'Ir al anuncio','url':f'https://es.wallapop.com/item/{article["web_slug"]}'}]]} image = open(f"/app/data/images/products/{article['id']}_composed.png", 'rb') files = { @@ -173,7 +175,7 @@ def send_article(article, product): 'photo': image, 'caption': (None, text), 'parse_mode': (None, ParseMode.MARKDOWN_V2), - 'reply_markup': (None, '{"inline_keyboard":[[{"text":"","url":"https://google.com"}]]}'), + 'reply_markup': (None, json.dumps(keyboard)), } response = requests.post(f'https://api.telegram.org/bot{constants.TELEGRAM_TOKEN}/sendPhoto', files=files)