Skip to content

Commit 3f07c5f

Browse files
committed
Updates for Bot API 5.5.
1 parent f2ef272 commit 3f07c5f

File tree

3 files changed

+75
-0
lines changed

3 files changed

+75
-0
lines changed

configs.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,6 +1406,54 @@ func (config SetChatAdministratorCustomTitle) params() (Params, error) {
14061406
return params, nil
14071407
}
14081408

1409+
// BanChatSenderChatConfig bans a channel chat in a supergroup or a channel. The
1410+
// owner of the chat will not be able to send messages and join live streams on
1411+
// behalf of the chat, unless it is unbanned first. The bot must be an
1412+
// administrator in the supergroup or channel for this to work and must have the
1413+
// appropriate administrator rights.
1414+
type BanChatSenderChatConfig struct {
1415+
ChatID int64
1416+
ChannelUsername string
1417+
SenderChatID int64
1418+
UntilDate int
1419+
}
1420+
1421+
func (config BanChatSenderChatConfig) method() string {
1422+
return "banChatSenderChat"
1423+
}
1424+
1425+
func (config BanChatSenderChatConfig) params() (Params, error) {
1426+
params := make(Params)
1427+
1428+
_ = params.AddFirstValid("chat_id", config.ChatID, config.ChannelUsername)
1429+
params.AddNonZero64("sender_chat_id", config.SenderChatID)
1430+
params.AddNonZero("until_date", config.UntilDate)
1431+
1432+
return params, nil
1433+
}
1434+
1435+
// UnbanChatSenderChatConfig unbans a previously banned channel chat in a
1436+
// supergroup or channel. The bot must be an administrator for this to work and
1437+
// must have the appropriate administrator rights.
1438+
type UnbanChatSenderChatConfig struct {
1439+
ChatID int64
1440+
ChannelUsername string
1441+
SenderChatID int64
1442+
}
1443+
1444+
func (config UnbanChatSenderChatConfig) method() string {
1445+
return "unbanChatSenderChat"
1446+
}
1447+
1448+
func (config UnbanChatSenderChatConfig) params() (Params, error) {
1449+
params := make(Params)
1450+
1451+
_ = params.AddFirstValid("chat_id", config.ChatID, config.ChannelUsername)
1452+
params.AddNonZero64("sender_chat_id", config.SenderChatID)
1453+
1454+
return params, nil
1455+
}
1456+
14091457
// ChatConfig contains information about getting information on a chat.
14101458
type ChatConfig struct {
14111459
ChatID int64

types.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,12 @@ type Chat struct {
264264
//
265265
// optional
266266
Bio string `json:"bio,omitempty"`
267+
// HasPrivateForwards is true if privacy settings of the other party in the
268+
// private chat allows to use tg://user?id=<user_id> links only in chats
269+
// with the user. Returned only in getChat.
270+
//
271+
// optional
272+
HasPrivateForwards bool `json:"has_private_forwards,omitempty"`
267273
// Description for groups, supergroups and channel chats
268274
//
269275
// optional
@@ -289,6 +295,16 @@ type Chat struct {
289295
//
290296
// optional
291297
SlowModeDelay int `json:"slow_mode_delay,omitempty"`
298+
// MessageAutoDeleteTime is the time after which all messages sent to the
299+
// chat will be automatically deleted; in seconds. Returned only in getChat.
300+
//
301+
// optional
302+
MessageAutoDeleteTime int `json:"message_auto_delete_time,omitempty"`
303+
// HasProtectedContent is true if messages from the chat can't be forwarded
304+
// to other chats. Returned only in getChat.
305+
//
306+
// optional
307+
HasProtectedContent bool `json:"has_protected_content,omitempty"`
292308
// StickerSetName is for supergroups, name of group sticker set.Returned
293309
// only in getChat.
294310
//
@@ -384,6 +400,11 @@ type Message struct {
384400
//
385401
// optional
386402
ForwardDate int `json:"forward_date,omitempty"`
403+
// IsAutomaticForward is true if the message is a channel post that was
404+
// automatically forwarded to the connected discussion group.
405+
//
406+
// optional
407+
IsAutomaticForward bool `json:"is_automatic_forward,omitempty"`
387408
// ReplyToMessage for replies, the original message.
388409
// Note that the Message object in this field will not contain further ReplyToMessage fields
389410
// even if it itself is a reply;
@@ -398,6 +419,10 @@ type Message struct {
398419
//
399420
// optional
400421
EditDate int `json:"edit_date,omitempty"`
422+
// HasProtectedContent is true if the message can't be forwarded.
423+
//
424+
// optional
425+
HasProtectedContent bool `json:"has_protected_content,omitempty"`
401426
// MediaGroupID is the unique identifier of a media message group this message belongs to;
402427
//
403428
// optional

types_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ var (
282282
_ Chattable = AnimationConfig{}
283283
_ Chattable = AudioConfig{}
284284
_ Chattable = BanChatMemberConfig{}
285+
_ Chattable = BanChatSenderChatConfig{}
285286
_ Chattable = CallbackConfig{}
286287
_ Chattable = ChatActionConfig{}
287288
_ Chattable = ChatAdministratorsConfig{}
@@ -332,6 +333,7 @@ var (
332333
_ Chattable = StopMessageLiveLocationConfig{}
333334
_ Chattable = StopPollConfig{}
334335
_ Chattable = UnbanChatMemberConfig{}
336+
_ Chattable = UnbanChatSenderChatConfig{}
335337
_ Chattable = UnpinChatMessageConfig{}
336338
_ Chattable = UpdateConfig{}
337339
_ Chattable = UserProfilePhotosConfig{}

0 commit comments

Comments
 (0)