@@ -42,6 +42,54 @@ const (
4242 ModeHTML = "HTML"
4343)
4444
45+ // Constant values for update types
46+ const (
47+ // New incoming message of any kind — text, photo, sticker, etc.
48+ UpdateTypeMessage = "message"
49+
50+ // New version of a message that is known to the bot and was edited
51+ UpdateTypeEditedMessage = "edited_message"
52+
53+ // New incoming channel post of any kind — text, photo, sticker, etc.
54+ UpdateTypeChannelPost = "channel_post"
55+
56+ // New version of a channel post that is known to the bot and was edited
57+ UpdateTypeEditedChannelPost = "edited_channel_post"
58+
59+ // New incoming inline query
60+ UpdateTypeInlineQuery = "inline_query"
61+
62+ // The result of an inline query that was chosen by a user and sent to their
63+ // chat partner. Please see the documentation on the feedback collecting for
64+ // details on how to enable these updates for your bot.
65+ UpdateTypeChosenInlineResult = "chosen_inline_result"
66+
67+ // New incoming callback query
68+ UpdateTypeCallbackQuery = "callback_query"
69+
70+ // New incoming shipping query. Only for invoices with flexible price
71+ UpdateTypeShippingQuery = "shipping_query"
72+
73+ // New incoming pre-checkout query. Contains full information about checkout
74+ UpdateTypePreCheckoutQuery = "pre_checkout_query"
75+
76+ // New poll state. Bots receive only updates about stopped polls and polls
77+ // which are sent by the bot
78+ UpdateTypePoll = "poll"
79+
80+ // A user changed their answer in a non-anonymous poll. Bots receive new votes
81+ // only in polls that were sent by the bot itself.
82+ UpdateTypePollAnswer = "poll_answer"
83+
84+ // The bot's chat member status was updated in a chat. For private chats, this
85+ // update is received only when the bot is blocked or unblocked by the user.
86+ UpdateTypeMyChatMember = "my_chat_member"
87+
88+ // The bot must be an administrator in the chat and must explicitly specify
89+ // this update in the list of allowed_updates to receive these updates.
90+ UpdateTypeChatMember = "chat_member"
91+ )
92+
4593// Library errors
4694const (
4795 // ErrBadFileType happens when you pass an unknown type
@@ -888,9 +936,10 @@ func (config FileConfig) params() (Params, error) {
888936
889937// UpdateConfig contains information about a GetUpdates request.
890938type UpdateConfig struct {
891- Offset int
892- Limit int
893- Timeout int
939+ Offset int
940+ Limit int
941+ Timeout int
942+ AllowedUpdates []string
894943}
895944
896945func (UpdateConfig ) method () string {
@@ -903,6 +952,7 @@ func (config UpdateConfig) params() (Params, error) {
903952 params .AddNonZero ("offset" , config .Offset )
904953 params .AddNonZero ("limit" , config .Limit )
905954 params .AddNonZero ("timeout" , config .Timeout )
955+ params .AddInterface ("allowed_updates" , config .AllowedUpdates )
906956
907957 return params , nil
908958}
0 commit comments