Closed Tillerino closed 8 years ago
Yes, you are right about Integer, but it doesn't say about Java's Integer. Here is a description of the Chat object: Unique identifier for this chat, not exceeding 1e13 by absolute value. And it's not an Integer, it's a Long.
So, I think I should change all Integer fields to Long, as 2 billions it's not enough. Probably Telegram use Integer as Int64. What do you think?
And of course, there is no need to cast bot.send( longChatId.intValue() )
I think Integer is right choice.
cause in documentation - It is safe to use 32-bit signed integers for storing all Integer fields unless otherwise noted.
everywhere must be used Integer type unless otherwise noted... you must return to Integer.
@maratkalibek thanks, I was just looking for this is documentation.. But for chat_id the otherwise is noted – it's a Long. And all send* methods should use Long too.
@pengrad I agree. Or maybe just use long
instead of Long
?
@pengrad hmmm, I'm looking here - https://core.telegram.org/bots/api#sendmessage
where it is specified that is have to be long? as I know, there is negative values for groups and positive for users.
Just read Chat object description
@Tillerino I decided not to use primitives to allow null
sorry, was my fault. @pengrad @Tillerino maybe start using String for send* chat_id parameters?
I am actually thinking how to support Integer for chats and String for channels. But using String for everything it's not a good solution.
Chat.id()
is of typeLong
, but allTelegramBot.send*()
methods haveInteger
as the first argument. Not only do you have to cast the id, which is already annoying enough, but because both types are boxed, you have to do a double cast:bot.sendWhatever((int) (long) Chat.id(), ...)
The specification says that the id field of the Chat type is an integer, so maybe
Chat.id
should be changed?