windkh / node-red-contrib-telegrambot

Telegram bot nodes for node-red.
Other
262 stars 116 forks source link

Can´t get editMessageMedia working #178

Closed gmahieux closed 3 years ago

gmahieux commented 3 years ago

Hi,

First of all, thank you for your amazing work!

I am trying to use the editMessageMedia you just added, to update the photo of a message but it ends with this error:

Caught exception in sender node:
Error: ETELEGRAM: 400 Bad Request: can't parse input media JSON object
when processing message: 
{"payload":{"chatId":XXXXXX,"type":"editMessageMedia","content":"/zoneminder/events/1/2021-05-08/708/alarm.jpg","options":{"chat_id":XXXXXX,"message_id":11853,"media":"/zoneminder/events/1/2021-05-08/708/alarm.jpg"}}...

The payload I send is :

{"payload":{
"chatId":XXXXXXX,
"type":"editMessageMedia",
"content":"/zoneminder/events/1/2021-05-08/708/alarm.jpg",
"options":{
    "chat_id":XXXXXX,
    "message_id":11853}
}}

I could successfully use editMessageCaption on this same message and send a new message using this photo. Maybe I am missing something but cannot see what :\

windkh commented 3 years ago

I discovered the same yesterday. In my eyes a bug in the underlying lib.

windkh commented 3 years ago

see https://github.com/yagop/node-telegram-bot-api/issues/876

windkh commented 3 years ago

Version 9.4.2 contains a workaround for this. Please tell me if it works for you.

gmahieux commented 3 years ago

I just gave a try and still have an error. Am I doing something wrong? the payload I send is of the same form as mentionned previously


Error: ETELEGRAM: 400 Bad Request: can't parse InputMedia: media not found
when processing message: 
{"payload":{"chatId":XXXXXXX,"type":"editMessageMedia","content":"/zoneminder/events/1/2021-05-14/1020/alarm.jpg","options":{"chat_id":XXXXXX,"message_id":12035,"media":"{\"0\":\"/\",\"1\":\"z\",\"2\":\"o\",\"3\":\"n\",\"4\":\"e\",\"5\":\"m\",\"6\":\"i\",\"7\":\"n\",\"8\":\"d\",\"9\":\"e\",\"10\":\"r\",\"11\":\"/\",\"12\":\"e\",\"13\":\"v\",\"14\":\"e\",\"15\":\"n\",\"16\":\"t\",\"17\":\"s\",\"18\":\"/\",\"19\":\"1\",\"20\":\"/\",\"21\":\"2\",\"22\":\"0\",\"23\":\"2\",\"24\":\"1\",\"25\":\"-\",\"26\":\"0\",\"27\":\"5\",\"28\":\"-\",\"29\":\"1\",\"30\":\"4\",\"31\":\"/\",\"32\":\"1\",\"33\":\"0\",\"34\":\"2\",\"35\":\"0\",\"36\":\"/\",\"37\":\"a\",\"38\":\"l\",\"39\":\"a\",\"40\":\"r\",\"41\":\"m\",\"42\":\".\",\"43\":\"j\",\"44\":\"p\",\"45\":\"g\"}"}}...
windkh commented 3 years ago

Did you try the example in the examples folder? does that one work?

gmahieux commented 3 years ago

I did not see the example. It works great now!! I was not sending the right data in the payload content.

Thanks for your reactivity and your work 👍

windkh commented 3 years ago

https://github.com/windkh/node-red-contrib-telegrambot/blob/master/examples/editMessageMedia.json

gmahieux commented 3 years ago

I meant I did not see the example the first time I tried version 9.4.2

Did you try the example in the examples folder? does that one work?

But after this message I tried the example and, as stated in my previous message, everything is fine now.

Thanks for your help

windkh commented 3 years ago

Perfect