fix: emit channel avatar service messages
This commit is contained in:
parent
4d9f1e271d
commit
c38dd73fdd
14 changed files with 346 additions and 27 deletions
|
|
@ -509,11 +509,13 @@ type ChannelDialog struct {
|
|||
type ChannelMessageActionType string
|
||||
|
||||
const (
|
||||
ChannelActionNone ChannelMessageActionType = ""
|
||||
ChannelActionCreate ChannelMessageActionType = "channel_create"
|
||||
ChannelActionChatAddUser ChannelMessageActionType = "chat_add_user"
|
||||
ChannelActionChatDelete ChannelMessageActionType = "chat_delete_user"
|
||||
ChannelActionChatJoined ChannelMessageActionType = "chat_joined"
|
||||
ChannelActionNone ChannelMessageActionType = ""
|
||||
ChannelActionCreate ChannelMessageActionType = "channel_create"
|
||||
ChannelActionChatAddUser ChannelMessageActionType = "chat_add_user"
|
||||
ChannelActionChatDelete ChannelMessageActionType = "chat_delete_user"
|
||||
ChannelActionChatEditPhoto ChannelMessageActionType = "chat_edit_photo"
|
||||
ChannelActionChatDeletePhoto ChannelMessageActionType = "chat_delete_photo"
|
||||
ChannelActionChatJoined ChannelMessageActionType = "chat_joined"
|
||||
// ChannelActionChatJoinedByLink 是经邀请链接加入的服务消息,
|
||||
// 渲染为 "X joined the group via invite link"。
|
||||
ChannelActionChatJoinedByLink ChannelMessageActionType = "chat_joined_by_link"
|
||||
|
|
@ -572,6 +574,8 @@ type ChannelMessageAction struct {
|
|||
StarGift *MessageStarGiftAction
|
||||
// Wallpaper 仅 set_chat_wallpaper 服务消息使用。
|
||||
Wallpaper *Wallpaper
|
||||
// Photo 仅 chat_edit_photo 服务消息使用。
|
||||
Photo *Photo
|
||||
}
|
||||
|
||||
// ChannelMessage is a single stored message in a channel/supergroup.
|
||||
|
|
@ -1341,6 +1345,16 @@ type UpdateChannelUsernameRequest struct {
|
|||
Username string
|
||||
}
|
||||
|
||||
// SetChannelPhotoResult describes a channel avatar mutation and its durable
|
||||
// service message.
|
||||
type SetChannelPhotoResult struct {
|
||||
Channel Channel
|
||||
Message ChannelMessage
|
||||
Event ChannelUpdateEvent
|
||||
Recipients []int64
|
||||
Changed bool
|
||||
}
|
||||
|
||||
// DeleteChannelResult describes a deleted channel.
|
||||
type DeleteChannelResult struct {
|
||||
Channel Channel
|
||||
|
|
|
|||
|
|
@ -349,6 +349,21 @@ type Photo struct {
|
|||
Sizes []PhotoSize `json:"sizes,omitempty"`
|
||||
}
|
||||
|
||||
func ClonePhotoPtr(photo *Photo) *Photo {
|
||||
if photo == nil {
|
||||
return nil
|
||||
}
|
||||
clone := *photo
|
||||
clone.FileReference = append([]byte(nil), photo.FileReference...)
|
||||
clone.Sizes = append([]PhotoSize(nil), photo.Sizes...)
|
||||
for i := range clone.Sizes {
|
||||
clone.Sizes[i].Bytes = append([]byte(nil), photo.Sizes[i].Bytes...)
|
||||
clone.Sizes[i].Sizes = append([]int(nil), photo.Sizes[i].Sizes...)
|
||||
clone.Sizes[i].BackgroundColors = append([]int(nil), photo.Sizes[i].BackgroundColors...)
|
||||
}
|
||||
return &clone
|
||||
}
|
||||
|
||||
// MessageMediaKind 枚举消息可挂载的媒体载荷。
|
||||
type MessageMediaKind string
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue