Updates for Bot API 5.5.

bot-api-6.1
Syfaro 2021-12-07 10:08:41 -05:00
parent f2ef2729ab
commit 3f07c5f676
3 changed files with 75 additions and 0 deletions

View File

@ -1406,6 +1406,54 @@ func (config SetChatAdministratorCustomTitle) params() (Params, error) {
return params, nil 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. // ChatConfig contains information about getting information on a chat.
type ChatConfig struct { type ChatConfig struct {
ChatID int64 ChatID int64

View File

@ -264,6 +264,12 @@ type Chat struct {
// //
// optional // optional
Bio string `json:"bio,omitempty"` 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 // Description for groups, supergroups and channel chats
// //
// optional // optional
@ -289,6 +295,16 @@ type Chat struct {
// //
// optional // optional
SlowModeDelay int `json:"slow_mode_delay,omitempty"` 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 // StickerSetName is for supergroups, name of group sticker set.Returned
// only in getChat. // only in getChat.
// //
@ -384,6 +400,11 @@ type Message struct {
// //
// optional // optional
ForwardDate int `json:"forward_date,omitempty"` 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. // ReplyToMessage for replies, the original message.
// Note that the Message object in this field will not contain further ReplyToMessage fields // Note that the Message object in this field will not contain further ReplyToMessage fields
// even if it itself is a reply; // even if it itself is a reply;
@ -398,6 +419,10 @@ type Message struct {
// //
// optional // optional
EditDate int `json:"edit_date,omitempty"` 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; // MediaGroupID is the unique identifier of a media message group this message belongs to;
// //
// optional // optional

View File

@ -282,6 +282,7 @@ var (
_ Chattable = AnimationConfig{} _ Chattable = AnimationConfig{}
_ Chattable = AudioConfig{} _ Chattable = AudioConfig{}
_ Chattable = BanChatMemberConfig{} _ Chattable = BanChatMemberConfig{}
_ Chattable = BanChatSenderChatConfig{}
_ Chattable = CallbackConfig{} _ Chattable = CallbackConfig{}
_ Chattable = ChatActionConfig{} _ Chattable = ChatActionConfig{}
_ Chattable = ChatAdministratorsConfig{} _ Chattable = ChatAdministratorsConfig{}
@ -332,6 +333,7 @@ var (
_ Chattable = StopMessageLiveLocationConfig{} _ Chattable = StopMessageLiveLocationConfig{}
_ Chattable = StopPollConfig{} _ Chattable = StopPollConfig{}
_ Chattable = UnbanChatMemberConfig{} _ Chattable = UnbanChatMemberConfig{}
_ Chattable = UnbanChatSenderChatConfig{}
_ Chattable = UnpinChatMessageConfig{} _ Chattable = UnpinChatMessageConfig{}
_ Chattable = UpdateConfig{} _ Chattable = UpdateConfig{}
_ Chattable = UserProfilePhotosConfig{} _ Chattable = UserProfilePhotosConfig{}