Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

offset is long in TG API terms #79

Closed
wants to merge 1 commit into from

Conversation

denizzzka
Copy link

Hi! I saw that there was an update and also decided to add something

@nexor
Copy link
Owner

nexor commented Jan 8, 2024

@denizzzka hey, could you please paste the link to the documentation? I found no information that offset can be larger than int as per official docs https://core.telegram.org/bots/api#getupdates

I also looked at the similar library in c# https://github.com/TelegramBots/Telegram.Bot/blob/master/src/Telegram.Bot/Requests/Getting%20Updates/GetUpdatesRequest.cs#L34
and seems that int is enough size for the offset.

@denizzzka
Copy link
Author

denizzzka commented Jan 8, 2024

Integer is a long, seems

because initially they used JSON, which treated integer as long

I also looked at the similar library in c#

This is official TG library?

@cyrusmsk
Copy link

@nexor
Copy link
Owner

nexor commented May 14, 2024

I suggest to close this PR since most of libraries use 4-bytes offset size, here are some examples:

https://github.com/reo7sp/tgbot-cpp/blob/master/src/Api.cpp#L12C42-L12C54

https://github.com/teloxide/teloxide/blob/bd98ba7e613e0fd7ec4fd1c210fc5edbb048f975/crates/teloxide/src/update_listeners/polling.rs#L301

Also according to the documentation:

It is safe to use 32-bit signed integers for storing all Integer fields unless otherwise noted.

@nexor nexor closed this May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants