Skip to content

Commit 30c412f

Browse files
Add update type documentation
1 parent 26a3c95 commit 30c412f

File tree

1 file changed

+37
-9
lines changed

1 file changed

+37
-9
lines changed

types.go

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,44 @@ type ResponseParameters struct {
2727

2828
// Update is an update response, from GetUpdates.
2929
type Update struct {
30-
UpdateID int `json:"update_id"`
31-
Message *Message `json:"message"`
32-
EditedMessage *Message `json:"edited_message"`
33-
ChannelPost *Message `json:"channel_post"`
34-
EditedChannelPost *Message `json:"edited_channel_post"`
35-
InlineQuery *InlineQuery `json:"inline_query"`
30+
// UpdateID is the update's unique identifier.
31+
// Update identifiers start from a certain positive number and increase sequentially.
32+
// This ID becomes especially handy if you're using Webhooks,
33+
// since it allows you to ignore repeated updates or to restore
34+
// the correct update sequence, should they get out of order.
35+
// If there are no new updates for at least a week, then identifier
36+
// of the next update will be chosen randomly instead of sequentially.
37+
UpdateID int `json:"update_id"`
38+
// Message new incoming message of any kind — text, photo, sticker, etc.
39+
// optional
40+
Message *Message `json:"message"`
41+
// EditedMessage
42+
// optional
43+
EditedMessage *Message `json:"edited_message"`
44+
// ChannelPost new version of a message that is known to the bot and was edited
45+
// optional
46+
ChannelPost *Message `json:"channel_post"`
47+
// EditedChannelPost new incoming channel post of any kind — text, photo, sticker, etc.
48+
// optional
49+
EditedChannelPost *Message `json:"edited_channel_post"`
50+
// InlineQuery new incoming inline query
51+
// optional
52+
InlineQuery *InlineQuery `json:"inline_query"`
53+
// ChosenInlineResult is the result of an inline query
54+
// that was chosen by a user and sent to their chat partner.
55+
// Please see our documentation on the feedback collecting
56+
// for details on how to enable these updates for your bot.
57+
// optional
3658
ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result"`
37-
CallbackQuery *CallbackQuery `json:"callback_query"`
38-
ShippingQuery *ShippingQuery `json:"shipping_query"`
39-
PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query"`
59+
// CallbackQuery new incoming callback query
60+
// optional
61+
CallbackQuery *CallbackQuery `json:"callback_query"`
62+
// ShippingQuery new incoming shipping query. Only for invoices with flexible price
63+
// optional
64+
ShippingQuery *ShippingQuery `json:"shipping_query"`
65+
// PreCheckoutQuery new incoming pre-checkout query. Contains full information about checkout
66+
// optional
67+
PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query"`
4068
}
4169

4270
// UpdatesChannel is the channel for getting updates.

0 commit comments

Comments
 (0)