kacpi2442 / am_bot

Using the toogoodtogo and foodsi APIs to notify me via a Telegram bot for open offers
39 stars 19 forks source link

how to remove pics from the telegram messages #12

Closed swiezaczek closed 1 year ago

swiezaczek commented 1 year ago

I don't know coding, but I tried to "blindly" fix the code, to delete pics from telegram messages . I believe its something about "telegram_bot_sendimage"

I tried to modify line in many ways or delete it: tg = telegram_bot_sendimage(item['category_picture'], message),

and many other things

but with partial success - the best I could do to change line 208 to "tg = telegram_bot_sendtext(message)" but I still get some generic TGTG picture. It would be nice if I could delete it completly.

---edit:

As far as I read about telegram API I should add parameter "disable_web_page_preview=True", but when I added it to def telegram_bot_sendtext, to make it look like "def telegram_bot_sendtext(bot_message, only_to_admin=True, disable_web_page_preview=True):" - it still shows me a preview.

Can you give me a clue?

swiezaczek commented 1 year ago

Fixed it myself:

send_text = 'https://api.telegram.org/bot' + bot_token + '/sendMessage?chat_id=' + bot_chatID + '&parse_mode=Markdown&disable_web_page_preview=True&text=' + quote(bot_message)