all repos — telegram-bot-api @ bot-api-7.5

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 `ChatMember` updates, you must explicitly add
16  `UpdateTypeChatMember` to your `AllowedUpdates` when getting updates or
17  setting your webhook.
18
19## Entities use UTF16
20
21- When extracting text entities using offsets and lengths, characters can appear
22  to be in incorrect positions. This is because Telegram uses UTF16 lengths
23  while Golang uses UTF8. It's possible to convert between the two, see
24  [issue #231][issue-231] for more details.
25
26[issue-231]: https://github.com/go-telegram-bot-api/telegram-bot-api/issues/231
27
28## GetUpdatesChan
29
30- This method is very basic and likely unsuitable for production use. Consider
31  creating your own implementation instead, as it's very simple to replicate.
32- This method only allows your bot to process one update at a time. You can
33  spawn goroutines to handle updates concurrently or switch to webhooks instead.
34  Webhooks are suggested for high traffic bots.
35
36## Nil Updates
37
38- At most one of the fields in an `Update` will be set to a non-nil value. When
39  evaluating updates, you must make sure you check that the field is not nil
40  before trying to access any of it's fields.
41
42## Privacy Mode
43
44- By default, bots only get updates directly addressed to them. If you need to
45  get all messages, you must disable privacy mode with Botfather. Bots already
46  added to groups will need to be removed and re-added for the changes to take
47  effect. You can read more on the [Telegram Bot API docs][api-docs].
48
49[api-docs]: https://core.telegram.org/bots/faq#what-messages-will-my-bot-get
50
51## User and Chat ID size
52
53- These types require up to 52 significant bits to store correctly, making a
54  64-bit integer type required in most languages. They are already `int64` types
55  in this library, but make sure you use correct types when saving them to a
56  database or passing them to another language.