rubenlagus / TelegramBots

Java library to create bots using Telegram Bots API
https://telegram.me/JavaBotsApi
MIT License
4.68k stars 1.18k forks source link

Bot does not respond any more: Numeric value out of range of int #1017

Closed Busch2207 closed 2 years ago

Busch2207 commented 2 years ago

@Edit: Sorry, I used an outdated version of the bot. I updated to the latest version. Now it works.

Hi,

Yesterday a buddy installed Telegram and I added him to a group with our telegram-bot. He has a chat-Id which is much bigger than an integer. (For privacy i slightly changed the names and numbers in the error-message) I think, the problem might be, that the id-field in the user-class is declared as an "Integer" but should be a "Long" value in the "User"-class. TelegramBots/telegrambots-meta/src/main/java/org/telegram/telegrambots/api/objects/User.java

Since the moment I added my buddy to the group, the log exploded with following error-message and the bot doesn't respond to anything any more. Even restarting or removing my buddy or the bot from the group hasn't worked:

Caused by: com.fasterxml.jackson.core.JsonParseException: Numeric value (5066057628) out of range of int at [Source: {"ok":true,"result":[{"update_id":390706188, "message":{"message_id":21162,"from":{"id":28243940,"is_bot":false,"first_name":"Busch2207","language_code":"en"},"chat":{"id":-266203370,"title":"Gruppe zul\u00e4ssig","type":"group","all_members_are_administrators":true},"date":1639987053,"new_chat_participant":{"id":5066057628,"is_bot":false,"first_name":"Max","last_name":"Mustermann"},"new_chat_member":{"id":5066057628,"is_bot":false,"first_name":"Max","last_name":"Mustermann"},"new_chat_members":[{"id":5066057628,"is_bot":false,"first_name":"Max","last_name":"Mustermann"}]}},{"update_id":390706189, "message":{"message_id":21163,"from":{"id":28243940,"is_bot":false,"first_name":"Busch2207","language_code":"en"},"chat":{"id":-266203370,"title":"Gruppe zul\u00e4ssig","type":"group","all_members_are_administrators":true},"date":1639987059,"left_chat_participant":{"id":5066057628,"is_bot":false,"first_name":"Max","last_name":"Mustermann"},"left_chat_member":{"id":5066057628,"is_bot":false,"first_name":"Max","last_name":"Mustermann"}}}]}; line: 2, column: 374] at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1702) at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:558) at com.fasterxml.jackson.core.base.ParserBase.convertNumberToInt(ParserBase.java:928) at com.fasterxml.jackson.core.base.ParserBase._parseIntValue(ParserBase.java:866) at com.fasterxml.jackson.core.base.ParserBase.getIntValue(ParserBase.java:694) at com.fasterxml.jackson.databind.deser.std.NumberDeserializers$IntegerDeserializer.deserialize(NumberDeserializers.java:306) at com.fasterxml.jackson.databind.deser.std.NumberDeserializers$IntegerDeserializer.deserialize(NumberDeserializers.java:286) at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:504) at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:108) at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:276) ... 20 more

KokaBaskin commented 2 years ago

the same problem

Busch2207 commented 2 years ago

the same problem

Like I edited in my post, I was able to fix the problem by updating to the latest version of the telegrambot-library. I used an outdated version of the bot.

Do you use the latest version of this library? So maybe this will work for you, too! :)

samreachyan commented 2 years ago

I still faced that issue. :disappointed:

Chase22 commented 2 years ago

@samreachyan Update the library