telegram-bot-go icon indicating copy to clipboard operation
telegram-bot-go copied to clipboard

APIResponseMessage result should handle bool also?

Open xenogenesi opened this issue 7 years ago • 3 comments
trafficstars

Thanks for sharing this package!

I'm using EditMessageText but getting this error:

2018/05/11 20:06:39 * json parse error: json: cannot unmarshal bool into Go struct field APIResponseMessage.result of type telegrambot.Message ({"ok":true,"result":true})

I'm a newbie of go but to me looks like json.Unmarshal within requestResponseMessage doesn't know how to populate APIResponseMessage's Result:result with the received but unexpected "result":true.

Perhaps EditMessageText should use something like requestResponseBool ?

edit

I'm testing this and it seems to work

xenogenesi avatar May 11 '18 18:05 xenogenesi

Oh, sorry I'm soooo late.

Maybe it is due to the difference between the response formats of bot and user.

It says: On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned..

I'll fix it as soon as I find any graceful solution for this issue.

Thank you :-)

meinside avatar Jul 27 '18 09:07 meinside

I added a new type and changed related codes for this issue. (d0041488a1b04a13ca36a691dca1d89aa847e6b3)

Hope it would help you with your case.

meinside avatar Jul 30 '18 02:07 meinside

Thanks, I'm currently working on something else, but in the future I may get back to it

xenogenesi avatar Jul 30 '18 11:07 xenogenesi