all repos — telegram-bot-api @ a36ca539258ee740dc581ead09abafb622517621

Golang bindings for the Telegram Bot API

docs/getting-started/important-notes.md (view raw)

 1# Important Notes
 2
 3The Telegram Bot API has a few potentially unanticipated behaviors. Here are a
 4few of them. If any behavior was surprising to you, please feel free to open a
 5pull request!
 6
 7## Callback Queries
 8
 9- Every callback query must be answered, even if there is nothing to display to
10  the user. Failure to do so will show a loading icon on the keyboard until the
11  operation times out.
12
13## ChatMemberUpdated
14
15- In order to receive `chat_member` and updates, you must explicitly add it to
16  your `allowed_updates` when getting updates or setting your webhook.
17
18## Entities use UTF16
19
20- When extracting text entities using offsets and lengths, characters can appear
21  to be in incorrect positions. This is because Telegram uses UTF16 lengths
22  while Golang uses UTF8. It's possible to convert between the two, see
23  [issue #231][issue-231] for more details.
24
25[issue-231]: https://github.com/go-telegram-bot-api/telegram-bot-api/issues/231
26
27## GetUpdatesChan
28
29- This method is very basic and likely unsuitable for production use. Consider
30  creating your own implementation instead, as it's very simple to replicate.
31- This method only allows your bot to process one update at a time. You can
32  spawn goroutines to handle updates concurrently or switch to webhooks instead.
33  Webhooks are suggested for high traffic bots.
34
35## Nil Updates
36
37- At most one of the fields in an `Update` will be set to a non-nil value. When
38  evaluating updates, you must make sure you check that the field is not nil
39  before trying to access any of it's fields.
40
41## User and Chat ID size
42
43- These types require up to 52 significant bits to store correctly, making a
44  64-bit integer type required in most languages. They are already `int64` types
45  in this library, but make sure you use correct types when saving them to a
46  database or passing them to another language.