owpengram-server/internal/domain/channel.go
2026-06-04 01:37:39 +08:00

1546 lines
44 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package domain
const (
// MaxChannelDifferenceLimit limits a single updates.getChannelDifference page.
MaxChannelDifferenceLimit = 100
// MaxChannelDifferenceTooLongMessages limits the latest message snapshot returned by channelDifferenceTooLong.
MaxChannelDifferenceTooLongMessages = 100
// MaxChannelParticipantsLimit limits a single participants page.
MaxChannelParticipantsLimit = 200
// MaxChannelParticipantsOffset bounds channels.getParticipants deep OFFSET work.
MaxChannelParticipantsOffset = 10000
// MaxChannelParticipantsQueryLength bounds member search strings before LIKE scans.
MaxChannelParticipantsQueryLength = 128
// MaxChannelInviteUsers limits a single inviteToChannel/createChat member batch.
MaxChannelInviteUsers = 200
// MaxChannelRealtimeFanout caps best-effort realtime channel pushes until a presence/subscription index exists.
MaxChannelRealtimeFanout = 500
// MaxSynchronousChannelDialogFanout bounds per-member channel_dialogs writes in the send transaction.
MaxSynchronousChannelDialogFanout = 1000
// MaxChannelTypingFanout caps transient typing fanout.
MaxChannelTypingFanout = MaxChannelRealtimeFanout
// MaxChannelAdminRankLength limits custom admin rank text.
MaxChannelAdminRankLength = 32
// MaxChannelInviteTitleLength limits invite link admin-only labels.
MaxChannelInviteTitleLength = 32
// MaxChannelInviteListLimit limits invite management pages.
MaxChannelInviteListLimit = 100
// MaxChannelHideJoinRequests limits one hideAllChatJoinRequests batch.
MaxChannelHideJoinRequests = 1000
// MaxChannelPendingJoinRecentRequesters limits recent_requesters carried in pending join request updates.
MaxChannelPendingJoinRecentRequesters = 5
// MaxAdminedPublicChannels limits channels.getAdminedPublicChannels payload size.
MaxAdminedPublicChannels = 200
// MaxChannelAdminLogLimit limits one channels.getAdminLog page.
MaxChannelAdminLogLimit = 100
// MaxChannelAdminLogAdmins limits admin filter fan-in.
MaxChannelAdminLogAdmins = 100
// MaxChannelAdminLogQueryLength limits free-text admin log search.
MaxChannelAdminLogQueryLength = 128
// MaxChannelHistoryQueryLength limits channel history/search query strings before LIKE scans.
MaxChannelHistoryQueryLength = 256
// MaxChannelSearchPostsLimit limits one global public posts search page.
MaxChannelSearchPostsLimit = 50
// MaxChannelGlobalSearchLimit limits one messages.searchGlobal channel page.
MaxChannelGlobalSearchLimit = 50
// MaxPublicChannelSearchLimit limits one contacts.search public peer lookup page.
MaxPublicChannelSearchLimit = 50
// MaxPublicChannelSearchQueryLength bounds public channel peer search strings.
MaxPublicChannelSearchQueryLength = 256
// MaxChannelReactionItems limits one channel reaction policy payload.
MaxChannelReactionItems = 64
// MaxChannelReactionEmoticonLength limits one emoji reaction string.
MaxChannelReactionEmoticonLength = 32
// MaxChannelMessageReactionsPerUser limits one user's reactions on one channel message.
MaxChannelMessageReactionsPerUser = 16
// MaxChannelMessageReactionRecent limits recent reactors embedded in messageReactions.
MaxChannelMessageReactionRecent = 3
// MaxChannelMessageReactionListLimit limits one messages.getMessageReactionsList page.
MaxChannelMessageReactionListLimit = 100
// MaxRecentMessageReactions limits one messages.getRecentReactions page.
MaxRecentMessageReactions = 100
// MaxTopMessageReactions limits one messages.getTopReactions page.
MaxTopMessageReactions = 100
// MaxSavedReactionTags limits one messages.getSavedReactionTags page.
MaxSavedReactionTags = 100
// MaxChannelReadParticipants limits per-message read receipt fan-in.
MaxChannelReadParticipants = 50
// ChannelReadMarkExpirePeriod matches TDesktop's default chat_read_mark_expire_period.
ChannelReadMarkExpirePeriod = 7 * 24 * 60 * 60
// MaxChannelReadOutboxFanout caps senders notified by one channel readHistory.
MaxChannelReadOutboxFanout = 128
// MaxChannelReadOutboxScanMessages bounds the read delta scanned for sender receipts.
MaxChannelReadOutboxScanMessages = 1000
// MaxCommonChannelsLimit limits one messages.getCommonChats page.
MaxCommonChannelsLimit = 100
// MaxLeftChannelsLimit limits one channels.getLeftChannels page.
MaxLeftChannelsLimit = 100
// MaxLeftChannelsOffset bounds the legacy count-offset export API.
MaxLeftChannelsOffset = 10000
// MaxInactiveChannelsLimit limits one channels.getInactiveChannels payload.
MaxInactiveChannelsLimit = 100
// DefaultChannelRecommendationsLimit matches Telegram Desktop's default similar channel preview cap.
DefaultChannelRecommendationsLimit = 10
// MaxChannelRecommendationsLimit bounds one channels.getChannelRecommendations payload.
MaxChannelRecommendationsLimit = 100
// MaxDiscussionGroupsLimit limits the channels.getGroupsForDiscussion payload.
MaxDiscussionGroupsLimit = 200
// MaxChannelRepliesLimit limits one messages.getReplies page.
MaxChannelRepliesLimit = 100
// MaxChannelUnreadMentionsLimit limits one messages.getUnreadMentions page.
MaxChannelUnreadMentionsLimit = 100
// MaxChannelUnreadReactionsLimit limits one messages.getUnreadReactions page.
MaxChannelUnreadReactionsLimit = 100
// MaxChannelForumTopicsLimit limits one messages.getForumTopics page.
MaxChannelForumTopicsLimit = 100
// MaxChannelForumTopicIDs limits one messages.getForumTopicsByID vector.
MaxChannelForumTopicIDs = 100
// MaxChannelForumTopicTitleLength bounds topic titles before persistence.
MaxChannelForumTopicTitleLength = 128
// DefaultForumTopicIconColor is Telegram Desktop's General-topic fallback blue.
DefaultForumTopicIconColor = 0x6FB9F0
// MaxChannelReadMentionsBatch limits one messages.readMentions clearing batch.
MaxChannelReadMentionsBatch = 1000
// MaxChannelReadReactionsBatch limits one messages.readReactions clearing batch.
MaxChannelReadReactionsBatch = 1000
// MaxDeleteParticipantReactionsBatch limits one moderation clear batch.
MaxDeleteParticipantReactionsBatch = 1000
// MaxChannelMentionRecipients limits mention state writes for one channel message.
MaxChannelMentionRecipients = 100
)
// ValidChannelSlowModeSeconds reports whether seconds is accepted by Telegram clients.
func ValidChannelSlowModeSeconds(seconds int) bool {
switch seconds {
case 0, 10, 30, 60, 300, 900, 3600:
return true
default:
return false
}
}
// ChannelMemberRole describes a member's role in a channel or megagroup.
type ChannelMemberRole string
const (
ChannelRoleCreator ChannelMemberRole = "creator"
ChannelRoleAdmin ChannelMemberRole = "admin"
ChannelRoleMember ChannelMemberRole = "member"
)
// ChannelMemberStatus describes current membership state.
type ChannelMemberStatus string
const (
ChannelMemberActive ChannelMemberStatus = "active"
ChannelMemberLeft ChannelMemberStatus = "left"
ChannelMemberKicked ChannelMemberStatus = "kicked"
ChannelMemberBanned ChannelMemberStatus = "banned"
)
// ChannelAdminRights is a domain-only representation of Telegram admin rights.
type ChannelAdminRights struct {
ChangeInfo bool
PostMessages bool
EditMessages bool
DeleteMessages bool
BanUsers bool
InviteUsers bool
PinMessages bool
AddAdmins bool
ManageCall bool
Anonymous bool
}
// ChannelBannedRights is a domain-only representation of Telegram banned rights.
type ChannelBannedRights struct {
ViewMessages bool
SendMessages bool
SendMedia bool
SendStickers bool
SendGifs bool
SendGames bool
SendInline bool
EmbedLinks bool
SendPolls bool
ChangeInfo bool
InviteUsers bool
PinMessages bool
UntilDate int
}
// ChannelReactionPolicyType describes which reactions are allowed in a channel.
type ChannelReactionPolicyType string
const (
ChannelReactionPolicyDefault ChannelReactionPolicyType = ""
ChannelReactionPolicyNone ChannelReactionPolicyType = "none"
ChannelReactionPolicyAll ChannelReactionPolicyType = "all"
ChannelReactionPolicySome ChannelReactionPolicyType = "some"
)
// ChannelReactionPolicy is a domain-only representation of chatReactions*.
type ChannelReactionPolicy struct {
Type ChannelReactionPolicyType
AllowCustom bool
Emoticons []string
CustomEmojiIDs []int64
Limit int
PaidEnabled bool
}
// ChannelPeerColor is a domain-only representation of PeerColor.
type ChannelPeerColor struct {
HasColor bool
Color int
BackgroundEmojiID int64
}
// Empty reports whether the peer has no explicit color state.
func (c ChannelPeerColor) Empty() bool {
return !c.HasColor && c.BackgroundEmojiID == 0
}
// ChannelEmojiStatus is a domain-only representation of a regular EmojiStatus.
type ChannelEmojiStatus struct {
DocumentID int64
Until int
}
// Empty reports whether no emoji status is set.
func (s ChannelEmojiStatus) Empty() bool {
return s.DocumentID == 0
}
// Channel is a Telegram channel/supergroup entity.
type Channel struct {
ID int64
AccessHash int64
CreatorUserID int64
Title string
About string
Username string
Broadcast bool
Megagroup bool
Forum bool
ForumTabs bool
Autotranslation bool
RestrictedSponsored bool
BroadcastMessagesAllowed bool
SendPaidMessagesStars int64
NoForwards bool
JoinToSend bool
JoinRequest bool
Signatures bool
PreHistoryHidden bool
ParticipantsHidden bool
AntiSpam bool
LinkedChatID int64
SlowmodeSeconds int
DefaultBannedRights ChannelBannedRights
ReactionPolicy ChannelReactionPolicy
Color ChannelPeerColor
ProfileColor ChannelPeerColor
EmojiStatus ChannelEmojiStatus
ParticipantsCount int
AdminsCount int
KickedCount int
BannedCount int
TopMessageID int
PinnedMessageID int
Pts int
TTLPeriod int
Date int
Deleted bool
// 当前头像(反范式存于 channels 表。PhotoID==0 表示无头像。
PhotoID int64
PhotoDCID int
PhotoStripped []byte
}
// ChannelMember is one user's channel membership and read state.
type ChannelMember struct {
ChannelID int64
UserID int64
InviterUserID int64
Role ChannelMemberRole
Status ChannelMemberStatus
JoinedAt int
LeftAt int
AdminRights ChannelAdminRights
BannedRights ChannelBannedRights
Rank string
AvailableMinID int
AvailableMinPts int
ReadInboxMaxID int
ReadInboxDate int
ReadOutboxMaxID int
UnreadMark bool
SlowmodeLastSendDate int
}
// ChannelDialog is the current user's owner-view dialog state for a channel.
type ChannelDialog struct {
UserID int64
ChannelID int64
FolderID int
TopMessageID int
TopMessageDate int
ReadInboxMaxID int
ReadOutboxMaxID int
UnreadCount int
UnreadMentions int
UnreadReactions int
Pinned bool
PinnedOrder int
UnreadMark bool
ViewForumAsMessages bool
DefaultSendAs *Peer
}
// ChannelMessageActionType identifies service messages generated by channel operations.
type ChannelMessageActionType string
const (
ChannelActionNone ChannelMessageActionType = ""
ChannelActionCreate ChannelMessageActionType = "channel_create"
ChannelActionChatAddUser ChannelMessageActionType = "chat_add_user"
ChannelActionChatDelete ChannelMessageActionType = "chat_delete_user"
ChannelActionChatJoined ChannelMessageActionType = "chat_joined"
ChannelActionEditTitle ChannelMessageActionType = "chat_edit_title"
ChannelActionTopicCreate ChannelMessageActionType = "topic_create"
ChannelActionTopicEdit ChannelMessageActionType = "topic_edit"
)
// ChannelMessageAction describes a service action without depending on tg.*.
type ChannelMessageAction struct {
Type ChannelMessageActionType
Title string
IconColor int
IconEmojiID int64
IconEmojiIDSet bool
TitleMissing bool
Closed *bool
Hidden *bool
UserIDs []int64
}
// ChannelMessage is a single stored message in a channel/supergroup.
type ChannelMessage struct {
ChannelID int64
ID int
RandomID int64
SenderUserID int64
From Peer
SendAs *Peer
Date int
EditDate int
Post bool
Silent bool
NoForwards bool
Body string
Entities []MessageEntity
ReplyTo *MessageReply
Forward *MessageForward
Discussion *ChannelDiscussionRef
Replies *ChannelMessageReplies
Reactions *ChannelMessageReactions
Action *ChannelMessageAction
Media *MessageMedia
Pts int
Deleted bool
}
// MessageReactionType identifies one stored reaction constructor without depending on TL types.
type MessageReactionType string
const (
MessageReactionEmoji MessageReactionType = "emoji"
)
// MessageReaction describes one supported message reaction value.
type MessageReaction struct {
Type MessageReactionType
Emoticon string
}
// ChannelMessageReactionCount is an aggregated reaction counter for one message.
type ChannelMessageReactionCount struct {
Reaction MessageReaction
Count int
ChosenOrder int
}
// ChannelMessagePeerReaction describes one peer's reaction entry.
type ChannelMessagePeerReaction struct {
ChannelID int64
MessageID int
SenderUserID int64
UserID int64
Reaction MessageReaction
Big bool
Unread bool
My bool
ChosenOrder int
Date int
}
// ChannelMessageReactions is the read model carried by channel messages and reaction updates.
type ChannelMessageReactions struct {
CanSeeList bool
Results []ChannelMessageReactionCount
Recent []ChannelMessagePeerReaction
}
// SetChannelMessageReactionsRequest replaces the current user's reactions for one message.
type SetChannelMessageReactionsRequest struct {
UserID int64
ChannelID int64
MessageID int
Reactions []MessageReaction
Big bool
AddToRecent bool
Date int
}
// ChannelMessageReactionsResult describes one reaction update.
type ChannelMessageReactionsResult struct {
Channel Channel
Message ChannelMessage
Messages []ChannelMessage
Reactions ChannelMessageReactions
Recipients []int64
}
// DeleteChannelParticipantReactionRequest removes one participant reaction on one message.
type DeleteChannelParticipantReactionRequest struct {
UserID int64
ChannelID int64
MessageID int
ParticipantUserID int64
Date int
}
// DeleteChannelParticipantReactionsRequest removes a bounded page of one participant's reactions.
type DeleteChannelParticipantReactionsRequest struct {
UserID int64
ChannelID int64
ParticipantUserID int64
Limit int
Date int
}
// DeleteChannelParticipantReactionsResult describes moderation reaction clears.
type DeleteChannelParticipantReactionsResult struct {
Channel Channel
Messages []ChannelMessage
Recipients []int64
Deleted int
}
// ChannelMessageReactionsRequest fetches reaction summaries for exact message ids.
type ChannelMessageReactionsRequest struct {
UserID int64
ChannelID int64
IDs []int
}
// ChannelMessageReactionsListRequest pages per-peer reactions for one message.
type ChannelMessageReactionsListRequest struct {
UserID int64
ChannelID int64
MessageID int
Reaction *MessageReaction
Offset string
Limit int
}
// ChannelMessageReactionsList is a bounded page for messages.getMessageReactionsList.
type ChannelMessageReactionsList struct {
Channel Channel
Message ChannelMessage
Count int
Reactions []ChannelMessagePeerReaction
NextOffset string
}
// RecentMessageReaction is one account-level recently used message reaction.
type RecentMessageReaction struct {
UserID int64
Reaction MessageReaction
Date int
}
// TopMessageReaction is one account-level frequently used message reaction.
type TopMessageReaction struct {
UserID int64
Reaction MessageReaction
Count int
Date int
}
// SavedReactionTag is one account-level custom title for a saved-message reaction tag.
type SavedReactionTag struct {
UserID int64
Reaction MessageReaction
Title string
Count int
}
// ChannelDiscussionRef links a broadcast post to its discussion megagroup root message.
type ChannelDiscussionRef struct {
ChannelID int64
MessageID int
}
// ChannelMessageReplies describes thread/comment counters without depending on TL types.
type ChannelMessageReplies struct {
Comments bool
Replies int
RepliesPts int
RecentRepliers []Peer
ChannelID int64
MaxID int
ReadMaxID int
}
// ChannelUpdateEventType identifies channel pts events.
type ChannelUpdateEventType string
const (
ChannelUpdateNewMessage ChannelUpdateEventType = "new_channel_message"
ChannelUpdateEditMessage ChannelUpdateEventType = "edit_channel_message"
ChannelUpdateDeleteMessages ChannelUpdateEventType = "delete_channel_messages"
ChannelUpdateParticipant ChannelUpdateEventType = "channel_participant"
ChannelUpdatePinnedMessages ChannelUpdateEventType = "pinned_channel_messages"
ChannelUpdateNoop ChannelUpdateEventType = "noop"
)
// ChannelUpdateEvent is the channel-scoped durable update log entry.
type ChannelUpdateEvent struct {
ChannelID int64
Type ChannelUpdateEventType
Pts int
PtsCount int
Date int
Message ChannelMessage
MessageIDs []int
SenderUserID int64
UserIDs []int64
Pinned bool
Previous ChannelMember
Participant ChannelMember
}
// FilterChannelUpdateEventForAvailableMinID hides message-scoped updates that
// belong to a member's pre-history-hidden range while preserving pts progress.
func FilterChannelUpdateEventForAvailableMinID(event ChannelUpdateEvent, availableMinID int) (ChannelUpdateEvent, bool) {
if availableMinID <= 0 {
return event, true
}
switch event.Type {
case ChannelUpdateNewMessage, ChannelUpdateEditMessage:
if event.Message.ID != 0 && event.Message.ID <= availableMinID {
return event, false
}
case ChannelUpdateDeleteMessages, ChannelUpdatePinnedMessages:
if len(event.MessageIDs) == 0 {
return event, true
}
ids := make([]int, 0, len(event.MessageIDs))
for _, id := range event.MessageIDs {
if id > availableMinID {
ids = append(ids, id)
}
}
if len(ids) == 0 {
return event, false
}
event.MessageIDs = ids
}
return event, true
}
// ChannelAdminLogEventType identifies durable admin log actions.
type ChannelAdminLogEventType string
const (
ChannelAdminLogChangeTitle ChannelAdminLogEventType = "change_title"
ChannelAdminLogChangeUsername ChannelAdminLogEventType = "change_username"
ChannelAdminLogChangeLinkedChat ChannelAdminLogEventType = "change_linked_chat"
ChannelAdminLogToggleSignatures ChannelAdminLogEventType = "toggle_signatures"
ChannelAdminLogTogglePreHistoryHidden ChannelAdminLogEventType = "toggle_pre_history_hidden"
ChannelAdminLogToggleForum ChannelAdminLogEventType = "toggle_forum"
ChannelAdminLogToggleAutotranslation ChannelAdminLogEventType = "toggle_autotranslation"
ChannelAdminLogToggleAntiSpam ChannelAdminLogEventType = "toggle_anti_spam"
ChannelAdminLogToggleSlowMode ChannelAdminLogEventType = "toggle_slow_mode"
ChannelAdminLogParticipantInvite ChannelAdminLogEventType = "participant_invite"
ChannelAdminLogParticipantJoin ChannelAdminLogEventType = "participant_join"
ChannelAdminLogParticipantLeave ChannelAdminLogEventType = "participant_leave"
ChannelAdminLogParticipantPromote ChannelAdminLogEventType = "participant_promote"
ChannelAdminLogParticipantDemote ChannelAdminLogEventType = "participant_demote"
ChannelAdminLogParticipantBan ChannelAdminLogEventType = "participant_ban"
ChannelAdminLogParticipantUnban ChannelAdminLogEventType = "participant_unban"
ChannelAdminLogParticipantKick ChannelAdminLogEventType = "participant_kick"
ChannelAdminLogParticipantUnkick ChannelAdminLogEventType = "participant_unkick"
ChannelAdminLogUpdatePinned ChannelAdminLogEventType = "update_pinned"
ChannelAdminLogSendMessage ChannelAdminLogEventType = "send_message"
ChannelAdminLogEditMessage ChannelAdminLogEventType = "edit_message"
ChannelAdminLogDeleteMessage ChannelAdminLogEventType = "delete_message"
)
// ChannelAdminLogEvent is a channel-scoped audit entry.
type ChannelAdminLogEvent struct {
ID int64
ChannelID int64
UserID int64
Date int
Type ChannelAdminLogEventType
PrevString string
NewString string
PrevBool bool
NewBool bool
PrevInt int
NewInt int
PrevParticipant *ChannelMember
NewParticipant *ChannelMember
Participant *ChannelMember
Message *ChannelMessage
PrevMessage *ChannelMessage
NewMessage *ChannelMessage
Query string
}
// ChannelAdminLogFilter mirrors the user-visible admin log filter categories.
type ChannelAdminLogFilter struct {
Join bool
Leave bool
Invite bool
Ban bool
Unban bool
Kick bool
Unkick bool
Promote bool
Demote bool
Info bool
Settings bool
Pinned bool
Edit bool
Delete bool
Send bool
Invites bool
Forums bool
SubExtend bool
EditRank bool
}
// Empty reports whether no admin log category filter was supplied.
func (f ChannelAdminLogFilter) Empty() bool {
return !f.Join && !f.Leave && !f.Invite && !f.Ban && !f.Unban && !f.Kick && !f.Unkick &&
!f.Promote && !f.Demote && !f.Info && !f.Settings && !f.Pinned && !f.Edit && !f.Delete &&
!f.Send && !f.Invites && !f.Forums && !f.SubExtend && !f.EditRank
}
// ChannelAdminLogRequest describes one bounded admin log page.
type ChannelAdminLogRequest struct {
UserID int64
ChannelID int64
Query string
AdminUserIDs []int64
MaxID int64
MinID int64
Limit int
Filter ChannelAdminLogFilter
}
// ChannelAdminLogResult is returned by channels.getAdminLog.
type ChannelAdminLogResult struct {
Channel Channel
Events []ChannelAdminLogEvent
}
// ChannelView contains channel data personalized for a viewer.
type ChannelView struct {
Channel Channel
Self ChannelMember
Dialog ChannelDialog
}
// ChannelParticipantList is a paged participant response.
type ChannelParticipantList struct {
Channel Channel
Participants []ChannelMember
Users []User
Count int
Hash int64
}
// ChannelParticipantsFilterKind identifies channels.getParticipants filters.
type ChannelParticipantsFilterKind string
const (
ChannelParticipantsRecent ChannelParticipantsFilterKind = "recent"
ChannelParticipantsAdmins ChannelParticipantsFilterKind = "admins"
ChannelParticipantsKicked ChannelParticipantsFilterKind = "kicked"
ChannelParticipantsBanned ChannelParticipantsFilterKind = "banned"
ChannelParticipantsSearch ChannelParticipantsFilterKind = "search"
ChannelParticipantsBots ChannelParticipantsFilterKind = "bots"
ChannelParticipantsContacts ChannelParticipantsFilterKind = "contacts"
ChannelParticipantsMentions ChannelParticipantsFilterKind = "mentions"
)
// ChannelParticipantsFilter is a domain-only participant list filter.
type ChannelParticipantsFilter struct {
Kind ChannelParticipantsFilterKind
Query string
}
// ChannelDialogList is a paged dialog response for channel/supergroup peers.
type ChannelDialogList struct {
Dialogs []Dialog
Messages []ChannelMessage
Channels []Channel
Users []User
Count int
Hash int64
}
// CommonChannelsRequest describes a bounded common-supergroup page.
type CommonChannelsRequest struct {
UserID int64
TargetUserID int64
MaxID int64
Limit int
CountOnly bool
}
// CommonChannelsResult contains shared megagroups and the full shared count.
type CommonChannelsResult struct {
Count int
Channels []Channel
}
// ChannelRecommendationsRequest describes one public broadcast channel recommendation page.
type ChannelRecommendationsRequest struct {
UserID int64
SourceChannelID int64
Limit int
}
// ChannelRecommendationsResult contains public broadcast channel recommendations and total count.
type ChannelRecommendationsResult struct {
Count int
Channels []Channel
}
// PublicChannelSearchResult contains contacts.search public channel/supergroup matches.
type PublicChannelSearchResult struct {
MyResults []Channel
Results []Channel
}
// LeftChannel is one channel/supergroup the user has left.
type LeftChannel struct {
Channel Channel
Self ChannelMember
}
// LeftChannelsResult contains a bounded page plus the full left count.
type LeftChannelsResult struct {
Count int
Channels []LeftChannel
}
// DiscussionGroupUpdateResult contains channels whose linked_chat_id changed.
type DiscussionGroupUpdateResult struct {
Channels []Channel
}
// ChannelHistory is a paged channel history response.
type ChannelHistory struct {
Channel Channel
Self ChannelMember
Channels []Channel
Topics []ChannelForumTopic
Messages []ChannelMessage
Users []User
Count int
Hash int64
}
// ChannelForumTopic is a forum topic materialized from the topic root service message.
type ChannelForumTopic struct {
ChannelID int64
TopicID int
CreatorUserID int64
Title string
IconColor int
IconEmojiID int64
TitleMissing bool
Closed bool
Hidden bool
Pinned bool
PinnedOrder int
Date int
TopMessageID int
ReadInboxMaxID int
ReadOutboxMaxID int
UnreadCount int
UnreadMentionsCount int
UnreadReactionsCount int
UnreadPollVotesCount int
}
// ChannelForumTopicFilter pages a forum topic list without OFFSET scans.
type ChannelForumTopicFilter struct {
ChannelID int64
Query string
OffsetDate int
OffsetID int
OffsetTopic int
Limit int
}
// ChannelForumTopicList contains a bounded topic page and channel context.
type ChannelForumTopicList struct {
Channel Channel
Dialog ChannelDialog
Topics []ChannelForumTopic
Messages []ChannelMessage
Users []User
Count int
}
// ChannelDifference is updates.getChannelDifference domain output.
type ChannelDifference struct {
Channel Channel
Self ChannelMember
Events []ChannelUpdateEvent
NewMessages []ChannelMessage
OtherUpdates []ChannelUpdateEvent
Users []User
Channels []Channel
Pts int
Final bool
TooLong bool
Dialog ChannelDialog
Timeout int
}
// CreateChannelRequest creates a broadcast channel or megagroup.
type CreateChannelRequest struct {
CreatorUserID int64
Title string
About string
RandomID int64
Broadcast bool
Megagroup bool
Forum bool
ForumTabs bool
TTLPeriod int
MemberUserIDs []int64
Date int
}
// CreateChannelResult is returned by channel creation paths.
type CreateChannelResult struct {
Channel Channel
Members []ChannelMember
Message ChannelMessage
Event ChannelUpdateEvent
Recipients []int64
}
// EditChannelTitleRequest edits a channel/supergroup title and emits a service message.
type EditChannelTitleRequest struct {
UserID int64
ChannelID int64
Title string
Date int
}
// EditChannelTitleResult describes one title edit.
type EditChannelTitleResult struct {
Channel Channel
Message ChannelMessage
Event ChannelUpdateEvent
Recipients []int64
}
// EditChannelAboutRequest modifies a channel/supergroup description.
type EditChannelAboutRequest struct {
UserID int64
ChannelID int64
About string
Date int
}
// EditChannelAdminRequest modifies a member's admin rights.
type EditChannelAdminRequest struct {
UserID int64
ChannelID int64
MemberID int64
AdminRights ChannelAdminRights
Rank string
Date int
}
// EditChannelAdminResult describes the participant transition.
type EditChannelAdminResult struct {
Channel Channel
Previous ChannelMember
Participant ChannelMember
Event ChannelUpdateEvent
Recipients []int64
Date int
}
// EditChannelBannedRequest modifies a participant's banned rights.
type EditChannelBannedRequest struct {
UserID int64
ChannelID int64
Participant Peer
BannedRights ChannelBannedRights
Date int
}
// EditChannelDefaultBannedRightsRequest modifies global default restrictions.
type EditChannelDefaultBannedRightsRequest struct {
UserID int64
ChannelID int64
BannedRights ChannelBannedRights
Date int
}
// EditChannelBannedResult describes the participant transition.
type EditChannelBannedResult struct {
Channel Channel
Previous ChannelMember
Participant ChannelMember
Event ChannelUpdateEvent
Recipients []int64
Date int
}
// DeleteChannelRequest deletes a channel/supergroup. Only the creator may do this.
type DeleteChannelRequest struct {
UserID int64
ChannelID int64
Date int
}
// UpdateChannelUsernameRequest updates or clears a channel public username.
type UpdateChannelUsernameRequest struct {
UserID int64
ChannelID int64
Username string
}
// DeleteChannelResult describes a deleted channel.
type DeleteChannelResult struct {
Channel Channel
Recipients []int64
}
// SendChannelMessageRequest sends one channel/supergroup message.
type SendChannelMessageRequest struct {
UserID int64
ChannelID int64
RandomID int64
Message string
Entities []MessageEntity
Media *MessageMedia
MentionUserIDs []int64
Silent bool
NoForwards bool
ReplyTo *MessageReply
Forward *MessageForward
SendAs *Peer
Action *ChannelMessageAction
Date int
}
// SaveChannelDefaultSendAsRequest stores the current user's default send-as peer for a channel dialog.
type SaveChannelDefaultSendAsRequest struct {
UserID int64
ChannelID int64
SendAs *Peer
}
// ChannelMessageViewsRequest reads and optionally increments channel-scoped message view counters.
type ChannelMessageViewsRequest struct {
UserID int64
ChannelID int64
IDs []int
Increment bool
Date int
}
// ChannelMessageViewsResult returns current view counters by visible message id.
type ChannelMessageViewsResult struct {
Views map[int]int
}
// ReadChannelMessageContentsRequest marks channel/supergroup content-read hints for one viewer.
type ReadChannelMessageContentsRequest struct {
UserID int64
ChannelID int64
IDs []int
}
// ReadChannelMessageContentsResult contains visible messages whose content-read hint can be synced.
type ReadChannelMessageContentsResult struct {
Channel Channel
Messages []ChannelMessage
ClearedUnreadReactionMessageIDs []int
}
// GetChannelMessageAuthorRequest resolves the original user author of one channel message.
type GetChannelMessageAuthorRequest struct {
UserID int64
ChannelID int64
ID int
}
// GetChannelMessageAuthorResult contains the resolved message author user id.
type GetChannelMessageAuthorResult struct {
Channel Channel
MessageID int
SenderUserID int64
}
// SendChannelMessageResult describes a channel message send.
type SendChannelMessageResult struct {
Channel Channel
Message ChannelMessage
Event ChannelUpdateEvent
Recipients []int64
Duplicate bool
Discussion *SendChannelDiscussionResult
}
// SendChannelDiscussionResult describes the discussion megagroup root created for a broadcast post.
type SendChannelDiscussionResult struct {
Channel Channel
Message ChannelMessage
Event ChannelUpdateEvent
Recipients []int64
}
// CreateChannelForumTopicRequest creates one forum topic root service message.
type CreateChannelForumTopicRequest struct {
UserID int64
ChannelID int64
Title string
TitleMissing bool
IconColor int
IconEmojiID int64
RandomID int64
SendAs *Peer
Date int
}
// CreateChannelForumTopicResult describes the topic root message and topic state.
type CreateChannelForumTopicResult struct {
Channel Channel
Topic ChannelForumTopic
Message ChannelMessage
Event ChannelUpdateEvent
Recipients []int64
Duplicate bool
}
// EditChannelForumTopicRequest edits topic metadata and emits a service message.
type EditChannelForumTopicRequest struct {
UserID int64
ChannelID int64
TopicID int
Title *string
IconEmojiID *int64
Closed *bool
Hidden *bool
Date int
}
// EditChannelForumTopicResult describes one topic edit service message.
type EditChannelForumTopicResult struct {
Channel Channel
Topic ChannelForumTopic
Message ChannelMessage
Event ChannelUpdateEvent
Recipients []int64
}
// UpdateChannelForumTopicPinnedRequest pins or unpins one topic.
type UpdateChannelForumTopicPinnedRequest struct {
UserID int64
ChannelID int64
TopicID int
Pinned bool
Date int
}
// UpdateChannelForumTopicPinnedResult describes one pinned-topic update.
type UpdateChannelForumTopicPinnedResult struct {
Channel Channel
Topic ChannelForumTopic
Recipients []int64
}
// ReorderChannelPinnedForumTopicsRequest stores a bounded pinned topic order.
type ReorderChannelPinnedForumTopicsRequest struct {
UserID int64
ChannelID int64
Order []int
Force bool
Date int
}
// ReorderChannelPinnedForumTopicsResult describes a pinned topic order update.
type ReorderChannelPinnedForumTopicsResult struct {
Channel Channel
Order []int
Recipients []int64
}
// DeleteChannelForumTopicHistoryRequest deletes one forum topic page.
type DeleteChannelForumTopicHistoryRequest struct {
UserID int64
ChannelID int64
TopicID int
Date int
}
// EditChannelMessageRequest edits one text message in a channel/supergroup.
type EditChannelMessageRequest struct {
UserID int64
ChannelID int64
ID int
Message string
Entities []MessageEntity
EditDate int
}
// EditChannelMessageResult describes one channel edit update.
type EditChannelMessageResult struct {
Channel Channel
Message ChannelMessage
Event ChannelUpdateEvent
Recipients []int64
}
// DeleteChannelMessagesRequest deletes a bounded set of channel/supergroup messages.
type DeleteChannelMessagesRequest struct {
UserID int64
ChannelID int64
IDs []int
Date int
}
// DeleteChannelMessagesResult describes one channel delete update.
type DeleteChannelMessagesResult struct {
Channel Channel
Event ChannelUpdateEvent
DeletedIDs []int
Recipients []int64
}
// DeleteChannelHistoryRequest clears or deletes a bounded channel/supergroup history page.
type DeleteChannelHistoryRequest struct {
UserID int64
ChannelID int64
MaxID int
ForEveryone bool
Date int
}
// DeleteChannelParticipantHistoryRequest deletes one bounded page of messages sent by a participant.
type DeleteChannelParticipantHistoryRequest struct {
UserID int64
ChannelID int64
ParticipantUserID int64
Date int
}
// DeleteChannelHistoryResult describes a channel history delete/clear page.
type DeleteChannelHistoryResult struct {
Channel Channel
Event ChannelUpdateEvent
DeletedIDs []int
Recipients []int64
Offset int
AvailableMinID int
}
// UpdateChannelPinnedMessageRequest pins or unpins one channel/supergroup message.
type UpdateChannelPinnedMessageRequest struct {
UserID int64
ChannelID int64
MessageID int
Pinned bool
Silent bool
Date int
}
// UpdateChannelPinnedMessageResult describes one pinned-message update.
type UpdateChannelPinnedMessageResult struct {
Channel Channel
Event ChannelUpdateEvent
Recipients []int64
}
// ChannelInvite is an exported invite link without TL dependencies.
type ChannelInvite struct {
ChannelID int64
InviteID int64
Hash string
AdminUserID int64
Title string
Permanent bool
Revoked bool
RequestNeeded bool
ExpireDate int
UsageLimit int
UsageCount int
RequestedCount int
Date int
}
// ExportChannelInviteRequest creates one invite link.
type ExportChannelInviteRequest struct {
UserID int64
ChannelID int64
Title string
RequestNeeded bool
ExpireDate int
UsageLimit int
LegacyRevokePermanent bool
Date int
}
// ExportChannelInviteResult returns the exported invite.
type ExportChannelInviteResult struct {
Channel Channel
Invite ChannelInvite
}
// CheckChannelInviteResult returns public invite preview info.
type CheckChannelInviteResult struct {
Channel Channel
Invite ChannelInvite
Already bool
Self ChannelMember
}
// ImportChannelInviteRequest imports an invite and joins the channel when no approval is needed.
type ImportChannelInviteRequest struct {
UserID int64
Hash string
Date int
}
// ChannelInviteListRequest describes an exported invite management page.
type ChannelInviteListRequest struct {
UserID int64
ChannelID int64
AdminUserID int64
Revoked bool
OffsetDate int
OffsetHash string
Limit int
}
// ChannelInviteList is a bounded exported invite page.
type ChannelInviteList struct {
Count int
Invites []ChannelInvite
}
// GetChannelInviteRequest fetches one exported invite by hash.
type GetChannelInviteRequest struct {
UserID int64
ChannelID int64
Hash string
}
// EditChannelInviteRequest edits or revokes an exported invite.
type EditChannelInviteRequest struct {
UserID int64
ChannelID int64
Hash string
Revoked bool
HasExpireDate bool
ExpireDate int
HasUsageLimit bool
UsageLimit int
HasRequestNeeded bool
RequestNeeded bool
HasTitle bool
Title string
Date int
}
// EditChannelInviteResult returns the edited invite and optional replacement.
type EditChannelInviteResult struct {
Invite ChannelInvite
NewInvite *ChannelInvite
}
// DeleteChannelInviteRequest removes one exported invite.
type DeleteChannelInviteRequest struct {
UserID int64
ChannelID int64
Hash string
}
// DeleteRevokedChannelInvitesRequest removes revoked invites for one admin.
type DeleteRevokedChannelInvitesRequest struct {
UserID int64
ChannelID int64
AdminUserID int64
Limit int
}
// ChannelAdminInviteCount aggregates invite counters for one admin.
type ChannelAdminInviteCount struct {
AdminUserID int64
InvitesCount int
RevokedInvitesCount int
}
// ChannelInviteImporter describes a user that joined or requested via an invite.
type ChannelInviteImporter struct {
ChannelID int64
InviteID int64
UserID int64
Date int
Requested bool
ApprovedBy int64
ViaChatlist bool
About string
}
// ChannelInviteImportersRequest describes importer/join-request pagination.
type ChannelInviteImportersRequest struct {
UserID int64
ChannelID int64
Hash string
Requested bool
Query string
OffsetDate int
OffsetUserID int64
Limit int
}
// ChannelInviteImporterList is a bounded importer page.
type ChannelInviteImporterList struct {
Count int
Importers []ChannelInviteImporter
}
// ChannelPendingJoinRequests is the admin-visible pending join request summary.
type ChannelPendingJoinRequests struct {
ChannelID int64
Count int
RecentRequesters []int64
}
// HideChannelJoinRequestRequest approves or dismisses one pending join request.
type HideChannelJoinRequestRequest struct {
UserID int64
ChannelID int64
TargetUserID int64
Approved bool
Date int
}
// HideChannelJoinRequestsRequest approves or dismisses pending join requests in a bounded batch.
type HideChannelJoinRequestsRequest struct {
UserID int64
ChannelID int64
Hash string
Approved bool
Limit int
Date int
}
// ChannelHistoryFilter describes channel history query conditions.
type ChannelHistoryFilter struct {
ChannelID int64
Query string
SenderUserID int64
OffsetID int
OffsetDate int
AddOffset int
Limit int
MinDate int
MaxDate int
MaxID int
MinID int
Hash int64
}
// ChannelSearchPostsRequest describes a bounded global public post search.
type ChannelSearchPostsRequest struct {
Hashtag string
Query string
OffsetRate int
OffsetChannelID int64
OffsetID int
Limit int
}
// ChannelGlobalSearchRequest describes a bounded messages.searchGlobal page
// over channel/supergroup messages visible to the current account.
type ChannelGlobalSearchRequest struct {
Query string
BroadcastsOnly bool
GroupsOnly bool
HasFolderID bool
FolderID int
OffsetRate int
OffsetChannelID int64
OffsetID int
MinDate int
MaxDate int
Limit int
}
// ChannelRepliesFilter describes messages.getReplies query conditions.
type ChannelRepliesFilter struct {
ChannelID int64
RootMessageID int
OffsetID int
OffsetDate int
AddOffset int
Limit int
MaxID int
MinID int
Hash int64
}
// ChannelUnreadMentionsFilter describes messages.getUnreadMentions query conditions.
type ChannelUnreadMentionsFilter struct {
ChannelID int64
TopMsgID int
OffsetID int
OffsetDate int
AddOffset int
Limit int
MaxID int
MinID int
}
// ChannelUnreadReactionsFilter describes messages.getUnreadReactions query conditions.
type ChannelUnreadReactionsFilter struct {
ChannelID int64
TopMsgID int
OffsetID int
AddOffset int
Limit int
MaxID int
MinID int
}
// ReadChannelMentionsRequest clears unread mention state for a channel/supergroup.
type ReadChannelMentionsRequest struct {
UserID int64
ChannelID int64
TopMsgID int
Limit int
}
// ReadChannelMentionsResult describes a bounded mentions clear operation.
type ReadChannelMentionsResult struct {
Channel Channel
Cleared int
Remaining int
Offset int
ChannelPts int
}
// ReadChannelReactionsRequest clears unread reaction state for a channel/supergroup.
type ReadChannelReactionsRequest struct {
UserID int64
ChannelID int64
TopMsgID int
Limit int
}
// ReadChannelReactionsResult describes a bounded reactions clear operation.
type ReadChannelReactionsResult struct {
Channel Channel
Cleared int
Remaining int
Offset int
ChannelPts int
}
// ChannelDiscussionMessage describes messages.getDiscussionMessage output.
type ChannelDiscussionMessage struct {
PostChannel Channel
DiscussionChannel Channel
Messages []ChannelMessage
Channels []Channel
Users []User
MaxID int
ReadInboxMaxID int
ReadOutboxMaxID int
UnreadCount int
}
// ChannelDifferenceRequest describes a channel difference query.
type ChannelDifferenceRequest struct {
UserID int64
ChannelID int64
Pts int
Limit int
Force bool
}
// ReadChannelHistoryRequest advances the current user's channel read watermark.
type ReadChannelHistoryRequest struct {
UserID int64
ChannelID int64
MaxID int
Date int
}
// ReadChannelHistoryResult describes a readHistory channel result.
type ReadChannelHistoryResult struct {
ChannelID int64
MaxID int
StillUnreadCount int
Changed bool
Pts int
Dialog ChannelDialog
OutboxUpdates []ChannelReadOutboxUpdate
}
// ChannelReadOutboxUpdate advances one sender's channel outbox read watermark.
type ChannelReadOutboxUpdate struct {
UserID int64
MaxID int
}
// ChannelReadParticipant describes one member's read receipt for a channel message.
type ChannelReadParticipant struct {
UserID int64
Date int
}
// ChannelReadParticipantsRequest queries read receipts for one small megagroup message.
type ChannelReadParticipantsRequest struct {
UserID int64
ChannelID int64
MessageID int
Limit int
Date int
}
// ChannelReadParticipantsResult is a bounded set of read receipt participants.
type ChannelReadParticipantsResult struct {
Channel Channel
Message ChannelMessage
Participants []ChannelReadParticipant
}