Updates for Bot API 5.5.
Syfaro syfaro@huefox.com
Tue, 07 Dec 2021 10:08:41 -0500
3 files changed,
75 insertions(+),
0 deletions(-)
M
configs.go
→
configs.go
@@ -1406,6 +1406,54 @@
return params, nil } +// BanChatSenderChatConfig bans a channel chat in a supergroup or a channel. The +// owner of the chat will not be able to send messages and join live streams on +// behalf of the chat, unless it is unbanned first. The bot must be an +// administrator in the supergroup or channel for this to work and must have the +// appropriate administrator rights. +type BanChatSenderChatConfig struct { + ChatID int64 + ChannelUsername string + SenderChatID int64 + UntilDate int +} + +func (config BanChatSenderChatConfig) method() string { + return "banChatSenderChat" +} + +func (config BanChatSenderChatConfig) params() (Params, error) { + params := make(Params) + + _ = params.AddFirstValid("chat_id", config.ChatID, config.ChannelUsername) + params.AddNonZero64("sender_chat_id", config.SenderChatID) + params.AddNonZero("until_date", config.UntilDate) + + return params, nil +} + +// UnbanChatSenderChatConfig unbans a previously banned channel chat in a +// supergroup or channel. The bot must be an administrator for this to work and +// must have the appropriate administrator rights. +type UnbanChatSenderChatConfig struct { + ChatID int64 + ChannelUsername string + SenderChatID int64 +} + +func (config UnbanChatSenderChatConfig) method() string { + return "unbanChatSenderChat" +} + +func (config UnbanChatSenderChatConfig) params() (Params, error) { + params := make(Params) + + _ = params.AddFirstValid("chat_id", config.ChatID, config.ChannelUsername) + params.AddNonZero64("sender_chat_id", config.SenderChatID) + + return params, nil +} + // ChatConfig contains information about getting information on a chat. type ChatConfig struct { ChatID int64
M
types.go
→
types.go
@@ -264,6 +264,12 @@ // getChat
// // optional Bio string `json:"bio,omitempty"` + // HasPrivateForwards is true if privacy settings of the other party in the + // private chat allows to use tg://user?id=<user_id> links only in chats + // with the user. Returned only in getChat. + // + // optional + HasPrivateForwards bool `json:"has_private_forwards,omitempty"` // Description for groups, supergroups and channel chats // // optional@@ -289,6 +295,16 @@ // getChat.
// // optional SlowModeDelay int `json:"slow_mode_delay,omitempty"` + // MessageAutoDeleteTime is the time after which all messages sent to the + // chat will be automatically deleted; in seconds. Returned only in getChat. + // + // optional + MessageAutoDeleteTime int `json:"message_auto_delete_time,omitempty"` + // HasProtectedContent is true if messages from the chat can't be forwarded + // to other chats. Returned only in getChat. + // + // optional + HasProtectedContent bool `json:"has_protected_content,omitempty"` // StickerSetName is for supergroups, name of group sticker set.Returned // only in getChat. //@@ -384,6 +400,11 @@ // ForwardDate for forwarded messages, date the original message was sent in Unix time;
// // optional ForwardDate int `json:"forward_date,omitempty"` + // IsAutomaticForward is true if the message is a channel post that was + // automatically forwarded to the connected discussion group. + // + // optional + IsAutomaticForward bool `json:"is_automatic_forward,omitempty"` // ReplyToMessage for replies, the original message. // Note that the Message object in this field will not contain further ReplyToMessage fields // even if it itself is a reply;@@ -398,6 +419,10 @@ // EditDate of the message was last edited in Unix time;
// // optional EditDate int `json:"edit_date,omitempty"` + // HasProtectedContent is true if the message can't be forwarded. + // + // optional + HasProtectedContent bool `json:"has_protected_content,omitempty"` // MediaGroupID is the unique identifier of a media message group this message belongs to; // // optional
M
types_test.go
→
types_test.go
@@ -282,6 +282,7 @@ var (
_ Chattable = AnimationConfig{} _ Chattable = AudioConfig{} _ Chattable = BanChatMemberConfig{} + _ Chattable = BanChatSenderChatConfig{} _ Chattable = CallbackConfig{} _ Chattable = ChatActionConfig{} _ Chattable = ChatAdministratorsConfig{}@@ -332,6 +333,7 @@ _ Chattable = StickerConfig{}
_ Chattable = StopMessageLiveLocationConfig{} _ Chattable = StopPollConfig{} _ Chattable = UnbanChatMemberConfig{} + _ Chattable = UnbanChatSenderChatConfig{} _ Chattable = UnpinChatMessageConfig{} _ Chattable = UpdateConfig{} _ Chattable = UserProfilePhotosConfig{}