@@ -340,8 +340,8 @@ type Chat struct {
340
340
//
341
341
// optional
342
342
MessageAutoDeleteTime int `json:"message_auto_delete_time,omitempty"`
343
- // HasAggressiveAntiSpamEnabled is true if aggressive anti-spam checks are enabled
344
- // in the supergroup. The field is only available to chat administrators.
343
+ // HasAggressiveAntiSpamEnabled is true if aggressive anti-spam checks are enabled
344
+ // in the supergroup. The field is only available to chat administrators.
345
345
// Returned only in getChat.
346
346
//
347
347
// optional
@@ -654,6 +654,14 @@ type Message struct {
654
654
//
655
655
// optional
656
656
SuccessfulPayment * SuccessfulPayment `json:"successful_payment,omitempty"`
657
+ // UserShared is a service message: a user was shared with the bot
658
+ //
659
+ // optional
660
+ UserShared * UserShared `json:"user_shared,omitempty"`
661
+ // ChatShared is a service message: a chat was shared with the bot
662
+ //
663
+ // optional
664
+ ChatShared * ChatShared `json:"chat_shared,omitempty"`
657
665
// ConnectedWebsite is the domain name of the website on which the user has
658
666
// logged in;
659
667
//
@@ -1323,6 +1331,24 @@ type GeneralForumTopicHidden struct {
1323
1331
type GeneralForumTopicUnhidden struct {
1324
1332
}
1325
1333
1334
+ // UserShared object contains information about the user whose identifier
1335
+ // was shared with the bot using a KeyboardButtonRequestUser button.
1336
+ type UserShared struct {
1337
+ // RequestID is an indentifier of the request.
1338
+ RequestID int `json:"request_id"`
1339
+ // UserID in an identifier of the shared user.
1340
+ UserID int64
1341
+ }
1342
+
1343
+ // ChatShared contains information about the chat whose identifier
1344
+ // was shared with the bot using a KeyboardButtonRequestChat button.
1345
+ type ChatShared struct {
1346
+ // RequestID is an indentifier of the request.
1347
+ RequestID int `json:"request_id"`
1348
+ // ChatID is an identifier of the shared chat.
1349
+ ChatID int64
1350
+ }
1351
+
1326
1352
// WriteAccessAllowed represents a service message about a user
1327
1353
// allowing a bot added to the attachment menu to write messages.
1328
1354
// Currently holds no information.
@@ -1455,6 +1481,20 @@ type KeyboardButton struct {
1455
1481
// Text of the button. If none of the optional fields are used,
1456
1482
// it will be sent as a message when the button is pressed.
1457
1483
Text string `json:"text"`
1484
+ // RequestUser if specified, pressing the button will open
1485
+ // a list of suitable users. Tapping on any user will send
1486
+ // their identifier to the bot in a "user_shared" service message.
1487
+ // Available in private chats only.
1488
+ //
1489
+ // optional
1490
+ RequestUser * KeyboardButtonRequestUser `json:"request_user,omitempty"`
1491
+ // RequestChat if specified, pressing the button will open
1492
+ // a list of suitable chats. Tapping on a chat will send
1493
+ // its identifier to the bot in a "chat_shared" service message.
1494
+ // Available in private chats only.
1495
+ //
1496
+ // optional
1497
+ RequestChat * KeyboardButtonRequestChat `json:"request_chat,omitempty"`
1458
1498
// RequestContact if True, the user's phone number will be sent
1459
1499
// as a contact when the button is pressed.
1460
1500
// Available in private chats only.
@@ -1480,6 +1520,72 @@ type KeyboardButton struct {
1480
1520
WebApp * WebAppInfo `json:"web_app,omitempty"`
1481
1521
}
1482
1522
1523
+ // KeyboardButtonRequestUser defines the criteria used to request
1524
+ // a suitable user. The identifier of the selected user will be shared
1525
+ // with the bot when the corresponding button is pressed.
1526
+ type KeyboardButtonRequestUser struct {
1527
+ // RequestID is a signed 32-bit identifier of the request.
1528
+ RequestID int `json:"request_id"`
1529
+ // UserIsBot pass True to request a bot,
1530
+ // pass False to request a regular user.
1531
+ // If not specified, no additional restrictions are applied.
1532
+ //
1533
+ // optional
1534
+ UserIsBot bool `json:"user_is_bot,omitempty"`
1535
+ // UserIsPremium pass True to request a premium user,
1536
+ // pass False to request a non-premium user.
1537
+ // If not specified, no additional restrictions are applied.
1538
+ //
1539
+ // optional
1540
+ UserIsPremium bool `json:"user_is_premium,omitempty"`
1541
+ }
1542
+
1543
+ // KeyboardButtonRequestChat defines the criteria used to request
1544
+ // a suitable chat. The identifier of the selected chat will be shared
1545
+ // with the bot when the corresponding button is pressed.
1546
+ type KeyboardButtonRequestChat struct {
1547
+ // RequestID is a signed 32-bit identifier of the request.
1548
+ RequestID int `json:"request_id"`
1549
+ // ChatIsChannel pass True to request a channel chat,
1550
+ // pass False to request a group or a supergroup chat.
1551
+ ChatIsChannel bool `json:"chat_is_channel"`
1552
+ // ChatIsForum pass True to request a forum supergroup,
1553
+ // pass False to request a non-forum chat.
1554
+ // If not specified, no additional restrictions are applied.
1555
+ //
1556
+ // optional
1557
+ ChatIsForum bool `json:"chat_is_forum,omitempty"`
1558
+ // ChatHasUsername pass True to request a supergroup or a channel with a username,
1559
+ // pass False to request a chat without a username.
1560
+ // If not specified, no additional restrictions are applied.
1561
+ //
1562
+ // optional
1563
+ ChatHasUsername bool `json:"chat_has_username,omitempty"`
1564
+ // ChatIsCreated pass True to request a chat owned by the user.
1565
+ // Otherwise, no additional restrictions are applied.
1566
+ //
1567
+ // optional
1568
+ ChatIsCreated bool `json:"chat_is_created,omitempty"`
1569
+ // UserAdministratorRights is a JSON-serialized object listing
1570
+ // the required administrator rights of the user in the chat.
1571
+ // If not specified, no additional restrictions are applied.
1572
+ //
1573
+ // optional
1574
+ UserAdministratorRights * ChatAdministratorRights `json:"user_administrator_rights,omitempty"`
1575
+ // BotAdministratorRights is a JSON-serialized object listing
1576
+ // the required administrator rights of the bot in the chat.
1577
+ // The rights must be a subset of user_administrator_rights.
1578
+ // If not specified, no additional restrictions are applied.
1579
+ //
1580
+ // optional
1581
+ BotAdministratorRights * ChatAdministratorRights `json:"bot_administrator_rights,omitempty"`
1582
+ // BotIsMember pass True to request a chat with the bot as a member.
1583
+ // Otherwise, no additional restrictions are applied.
1584
+ //
1585
+ // optional
1586
+ BotIsMember bool `json:"bot_is_member,omitempty"`
1587
+ }
1588
+
1483
1589
// KeyboardButtonPollType represents type of poll, which is allowed to
1484
1590
// be created and sent when the corresponding button is pressed.
1485
1591
type KeyboardButtonPollType struct {
@@ -1852,11 +1958,36 @@ type ChatMember struct {
1852
1958
//
1853
1959
// optional
1854
1960
CanSendMessages bool `json:"can_send_messages,omitempty"`
1855
- // CanSendMediaMessages restricted only.
1856
- // True, if the user is allowed to send text messages, contacts, locations and venues
1961
+ // CanSendAudios restricted only.
1962
+ // True, if the user is allowed to send audios
1963
+ //
1964
+ // optional
1965
+ CanSendAudios bool
1966
+ // CanSendDocuments restricted only.
1967
+ // True, if the user is allowed to send documents
1968
+ //
1969
+ // optional
1970
+ CanSendDocuments bool
1971
+ // CanSendPhotos is restricted only.
1972
+ // True, if the user is allowed to send photos
1857
1973
//
1858
1974
// optional
1859
- CanSendMediaMessages bool `json:"can_send_media_messages,omitempty"`
1975
+ CanSendPhotos bool
1976
+ // CanSendVideos restricted only.
1977
+ // True, if the user is allowed to send videos
1978
+ //
1979
+ // optional
1980
+ CanSendVideos bool
1981
+ // CanSendVideoNotes restricted only.
1982
+ // True, if the user is allowed to send video notes
1983
+ //
1984
+ // optional
1985
+ CanSendVideoNotes bool
1986
+ // CanSendVoiceNotes restricted only.
1987
+ // True, if the user is allowed to send voice notes
1988
+ //
1989
+ // optional
1990
+ CanSendVoiceNotes bool
1860
1991
// CanSendPolls restricted only.
1861
1992
// True, if the user is allowed to send polls
1862
1993
//
@@ -1887,6 +2018,27 @@ func (chat ChatMember) HasLeft() bool { return chat.Status == "left" }
1887
2018
// WasKicked returns if the ChatMember was kicked from the chat.
1888
2019
func (chat ChatMember ) WasKicked () bool { return chat .Status == "kicked" }
1889
2020
2021
+ // SetCanSendMediaMessages is a method to replace field "can_send_media_messages".
2022
+ // It sets CanSendAudio, CanSendDocuments, CanSendPhotos, CanSendVideos,
2023
+ // CanSendVideoNotes, CanSendVoiceNotes to passed value.
2024
+ func (chat * ChatMember ) SetCanSendMediaMessages (b bool ) {
2025
+ chat .CanSendAudios = b
2026
+ chat .CanSendDocuments = b
2027
+ chat .CanSendPhotos = b
2028
+ chat .CanSendVideos = b
2029
+ chat .CanSendVideoNotes = b
2030
+ chat .CanSendVoiceNotes = b
2031
+ }
2032
+
2033
+ // CanSendMediaMessages method to replace field "can_send_media_messages".
2034
+ // It returns true if CanSendAudio and CanSendDocuments and CanSendPhotos and CanSendVideos and
2035
+ // CanSendVideoNotes and CanSendVoiceNotes are true.
2036
+ func (chat * ChatMember ) CanSendMediaMessages () bool {
2037
+ return chat .CanSendAudios && chat .CanSendDocuments &&
2038
+ chat .CanSendPhotos && chat .CanSendVideos &&
2039
+ chat .CanSendVideoNotes && chat .CanSendVoiceNotes
2040
+ }
2041
+
1890
2042
// ChatMemberUpdated represents changes in the status of a chat member.
1891
2043
type ChatMemberUpdated struct {
1892
2044
// Chat the user belongs to.
@@ -1912,6 +2064,8 @@ type ChatJoinRequest struct {
1912
2064
Chat Chat `json:"chat"`
1913
2065
// User that sent the join request.
1914
2066
From User `json:"from"`
2067
+ // UserChatID identifier of a private chat with the user who sent the join request.
2068
+ UserChatID int64 `json:"user_chat_id"`
1915
2069
// Date the request was sent in Unix time.
1916
2070
Date int `json:"date"`
1917
2071
// Bio of the user.
@@ -1932,12 +2086,30 @@ type ChatPermissions struct {
1932
2086
//
1933
2087
// optional
1934
2088
CanSendMessages bool `json:"can_send_messages,omitempty"`
1935
- // CanSendMediaMessages is true, if the user is allowed to send audios,
1936
- // documents, photos, videos, video notes and voice notes, implies
1937
- // can_send_messages
2089
+ // CanSendAudios is true, if the user is allowed to send audios
2090
+ //
2091
+ // optional
2092
+ CanSendAudios bool
2093
+ // CanSendDocuments is true, if the user is allowed to send documents
2094
+ //
2095
+ // optional
2096
+ CanSendDocuments bool
2097
+ // CanSendPhotos is true, if the user is allowed to send photos
1938
2098
//
1939
2099
// optional
1940
- CanSendMediaMessages bool `json:"can_send_media_messages,omitempty"`
2100
+ CanSendPhotos bool
2101
+ // CanSendVideos is true, if the user is allowed to send videos
2102
+ //
2103
+ // optional
2104
+ CanSendVideos bool
2105
+ // CanSendVideoNotes is true, if the user is allowed to send video notes
2106
+ //
2107
+ // optional
2108
+ CanSendVideoNotes bool
2109
+ // CanSendVoiceNotes is true, if the user is allowed to send voice notes
2110
+ //
2111
+ // optional
2112
+ CanSendVoiceNotes bool
1941
2113
// CanSendPolls is true, if the user is allowed to send polls, implies
1942
2114
// can_send_messages
1943
2115
//
@@ -1975,6 +2147,27 @@ type ChatPermissions struct {
1975
2147
CanManageTopics bool `json:"can_manage_topics,omitempty"`
1976
2148
}
1977
2149
2150
+ // SetCanSendMediaMessages is a method to replace field "can_send_media_messages".
2151
+ // It sets CanSendAudio, CanSendDocuments, CanSendPhotos, CanSendVideos,
2152
+ // CanSendVideoNotes, CanSendVoiceNotes to passed value.
2153
+ func (c * ChatPermissions ) SetCanSendMediaMessages (b bool ) {
2154
+ c .CanSendAudios = b
2155
+ c .CanSendDocuments = b
2156
+ c .CanSendPhotos = b
2157
+ c .CanSendVideos = b
2158
+ c .CanSendVideoNotes = b
2159
+ c .CanSendVoiceNotes = b
2160
+ }
2161
+
2162
+ // CanSendMediaMessages method to replace field "can_send_media_messages".
2163
+ // It returns true if CanSendAudio and CanSendDocuments and CanSendPhotos and CanSendVideos and
2164
+ // CanSendVideoNotes and CanSendVoiceNotes are true.
2165
+ func (c * ChatPermissions ) CanSendMediaMessages () bool {
2166
+ return c .CanSendAudios && c .CanSendDocuments &&
2167
+ c .CanSendPhotos && c .CanSendVideos &&
2168
+ c .CanSendVideoNotes && c .CanSendVoiceNotes
2169
+ }
2170
+
1978
2171
// ChatLocation represents a location to which a chat is connected.
1979
2172
type ChatLocation struct {
1980
2173
// Location is the location to which the supergroup is connected. Can't be a
0 commit comments