pengrad / java-telegram-bot-api

Telegram Bot API for Java
https://core.telegram.org/bots
Apache License 2.0
1.81k stars 373 forks source link

BOT API v7.9 #394

Closed mircoianese closed 2 months ago

mircoianese commented 2 months ago

Hello,

this PR updates the library to v7.9 (changelog).

Note: There is this change in the API update:

But the class ChatMember on the library already has the until_date field as it was implemented in a slightly different way that the one we used lately for other classes (like ReactionType, ChatBoostSource etc.) where we have used JSON Adapters to cast to the specific object.

Maybe we should consider align the implementation of the ChatMember class (@anfanik what do you think?)

Thanks

mircoianese commented 2 months ago

I've found an issue on how we currently implemented fallbacks for GSON type adapters that's causing a StackOverflowException on updates deserialization for all users on lib version 7.0+ for messages in channels that uses the new "ReactionTypePaid".

@pengrad This should be merged asap. Thanks!

pengrad commented 2 months ago

Thanks Mirco!

Wow, using context.deserialize() for own Type wasn't good idea. I didn't think about recursion at all. But intention was good I believe, because I wanted to preserve "type" that was already extracted from json. Why return "unknown" when we have actual type?

So I've updated it here https://github.com/pengrad/java-telegram-bot-api/commit/ba791f713f12ecf9491b89cac4b4cf877c5c8e29 returning the parent class with the proper type. Also added GsonAdaptersTest to catch such issues in future.

I've resolved conflicts in your branch, removed *Unknown classes, looks good to go now. Please check if it's good to you.

mircoianese commented 2 months ago

Looks good to me! Your solution is definitely better! :)

Thank you