Documentation ¶
Overview ¶
Package members defines interfaces for working with chat/channel members.
Index ¶
- type AdminRights
- type Callback
- type ChannelInfoUnavailableError
- type ChannelMember
- func (c ChannelMember) InvitedBy() (peers.User, bool)
- func (c ChannelMember) JoinDate() (time.Time, bool)
- func (c ChannelMember) Kick(ctx context.Context, revokeHistory bool) error
- func (c ChannelMember) Rank() (string, bool)
- func (c ChannelMember) Raw() tg.ChannelParticipantClass
- func (c ChannelMember) Status() Status
- func (c ChannelMember) User() peers.User
- type ChannelMembers
- func (c *ChannelMembers) Count(ctx context.Context) (int, error)
- func (c *ChannelMembers) EditAdminRights(ctx context.Context, admin tg.InputUserClass, options AdminRights) error
- func (c *ChannelMembers) EditMemberRights(ctx context.Context, member tg.InputPeerClass, options MemberRights) error
- func (c *ChannelMembers) EditRights(ctx context.Context, options MemberRights) error
- func (c *ChannelMembers) ForEach(ctx context.Context, cb Callback) error
- func (c *ChannelMembers) Kick(ctx context.Context, member tg.InputUserClass, revokeHistory bool) error
- func (c *ChannelMembers) KickMember(ctx context.Context, member tg.InputPeerClass) error
- func (c *ChannelMembers) Peer() peers.Peer
- type ChannelQuery
- func (q ChannelQuery) Admins() *ChannelMembers
- func (q ChannelQuery) Banned(query string) *ChannelMembers
- func (q ChannelQuery) Bots() *ChannelMembers
- func (q ChannelQuery) Contacts(query string) *ChannelMembers
- func (q ChannelQuery) Custom(filter tg.ChannelParticipantsFilterClass) *ChannelMembers
- func (q ChannelQuery) Kicked(query string) *ChannelMembers
- func (q ChannelQuery) Recent() *ChannelMembers
- func (q ChannelQuery) Search(query string) *ChannelMembers
- type ChatInfoUnavailableError
- type ChatMember
- type ChatMembers
- func (c *ChatMembers) Count(ctx context.Context) (int, error)
- func (c *ChatMembers) EditAdmin(ctx context.Context, user tg.InputUserClass, isAdmin bool) error
- func (c *ChatMembers) EditRights(ctx context.Context, options MemberRights) error
- func (c *ChatMembers) ForEach(ctx context.Context, cb Callback) error
- func (c *ChatMembers) Kick(ctx context.Context, member tg.InputUserClass, revokeHistory bool) error
- func (c *ChatMembers) Peer() peers.Peer
- type Member
- type MemberRights
- type Members
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdminRights ¶
type AdminRights struct { // Indicates the role (rank) of the admin in the group: just an arbitrary string. // // If empty, will not be used. Rank string // If set, allows the admin to modify the description of the channel/supergroup. ChangeInfo bool // If set, allows the admin to post messages in the channel. PostMessages bool // If set, allows the admin to also edit messages from other admins in the channel. EditMessages bool // If set, allows the admin to also delete messages from other admins in the channel. DeleteMessages bool // If set, allows the admin to ban users from the channel/supergroup. BanUsers bool // If set, allows the admin to invite users in the channel/supergroup. InviteUsers bool // If set, allows the admin to pin messages in the channel/supergroup. PinMessages bool // If set, allows the admin to add other admins with the same (or more limited) // permissions in the channel/supergroup. AddAdmins bool // Whether this admin is anonymous. Anonymous bool // If set, allows the admin to change group call/livestream settings. ManageCall bool // Set this flag if none of the other flags are set, but you still want the user to be an // admin. Other bool }
AdminRights represents admin right settings.
func (AdminRights) IntoChatAdminRights ¶
func (b AdminRights) IntoChatAdminRights() (r tg.ChatAdminRights)
IntoChatAdminRights converts AdminRights into tg.ChatAdminRights.
type ChannelInfoUnavailableError ¶
type ChannelInfoUnavailableError struct { }
ChannelInfoUnavailableError reports that channel members info is not available.
func (*ChannelInfoUnavailableError) Error ¶
func (c *ChannelInfoUnavailableError) Error() string
Error implements error.
type ChannelMember ¶
type ChannelMember struct {
// contains filtered or unexported fields
}
ChannelMember is channel Member.
func (ChannelMember) InvitedBy ¶
func (c ChannelMember) InvitedBy() (peers.User, bool)
InvitedBy returns user that invited this member.
func (ChannelMember) JoinDate ¶
func (c ChannelMember) JoinDate() (time.Time, bool)
JoinDate returns member join date, if it is available.
func (ChannelMember) Kick ¶
func (c ChannelMember) Kick(ctx context.Context, revokeHistory bool) error
Kick kicks this member.
If revokeHistory is set, will delete all messages from this member.
func (ChannelMember) Raw ¶
func (c ChannelMember) Raw() tg.ChannelParticipantClass
Raw returns raw member object.
func (ChannelMember) User ¶
func (c ChannelMember) User() peers.User
User returns member User object.
type ChannelMembers ¶
type ChannelMembers struct {
// contains filtered or unexported fields
}
ChannelMembers is channel Members.
func Channel ¶
func Channel(channel peers.Channel) *ChannelMembers
Channel returns recent channel members.
func (*ChannelMembers) Count ¶
func (c *ChannelMembers) Count(ctx context.Context) (int, error)
Count returns total count of members.
func (*ChannelMembers) EditAdminRights ¶
func (c *ChannelMembers) EditAdminRights( ctx context.Context, admin tg.InputUserClass, options AdminRights, ) error
EditAdminRights edits admin rights of given user in this channel.
func (*ChannelMembers) EditMemberRights ¶
func (c *ChannelMembers) EditMemberRights( ctx context.Context, member tg.InputPeerClass, options MemberRights, ) error
EditMemberRights edits member rights in this channel.
func (*ChannelMembers) EditRights ¶
func (c *ChannelMembers) EditRights(ctx context.Context, options MemberRights) error
EditRights edits rights of all members in this channel.
func (*ChannelMembers) ForEach ¶
func (c *ChannelMembers) ForEach(ctx context.Context, cb Callback) error
ForEach calls cb for every member of channel.
May return ChannelInfoUnavailableError.
func (*ChannelMembers) Kick ¶
func (c *ChannelMembers) Kick(ctx context.Context, member tg.InputUserClass, revokeHistory bool) error
Kick kicks user member.
Needed for parity with ChatMembers to define common interface.
If revokeHistory is set, will delete all messages from this member.
func (*ChannelMembers) KickMember ¶
func (c *ChannelMembers) KickMember(ctx context.Context, member tg.InputPeerClass) error
KickMember kicks member.
Unlike Kick, KickMember can be used to kick chat member that uses send-as-channel mode.
type ChannelQuery ¶
ChannelQuery is builder for channel members querying.
func (ChannelQuery) Admins ¶
func (q ChannelQuery) Admins() *ChannelMembers
Admins queries admins members.
func (ChannelQuery) Banned ¶
func (q ChannelQuery) Banned(query string) *ChannelMembers
Banned queries banned members.
func (ChannelQuery) Contacts ¶
func (q ChannelQuery) Contacts(query string) *ChannelMembers
Contacts queries members that are also contacts.
func (ChannelQuery) Custom ¶
func (q ChannelQuery) Custom(filter tg.ChannelParticipantsFilterClass) *ChannelMembers
Custom creates query with custom filter.
func (ChannelQuery) Kicked ¶
func (q ChannelQuery) Kicked(query string) *ChannelMembers
Kicked queries kicked members.
func (ChannelQuery) Recent ¶
func (q ChannelQuery) Recent() *ChannelMembers
Recent queries recent members.
func (ChannelQuery) Search ¶
func (q ChannelQuery) Search(query string) *ChannelMembers
Search queries members by given name.
type ChatInfoUnavailableError ¶
type ChatInfoUnavailableError struct {
}ChatInfoUnavailableError reports that chat members info is not available.
func (*ChatInfoUnavailableError) Error ¶
func (c *ChatInfoUnavailableError) Error() string
Error implements error.
type ChatMember ¶
type ChatMember struct {
// contains filtered or unexported fields
}
ChatMember is chat Member.
func (ChatMember) InvitedBy ¶
func (c ChatMember) InvitedBy() (peers.User, bool)
InvitedBy returns user that invited this member.
func (ChatMember) JoinDate ¶
func (c ChatMember) JoinDate() (time.Time, bool)
JoinDate returns member join date, if it is available.
func (ChatMember) Kick ¶
func (c ChatMember) Kick(ctx context.Context, revokeHistory bool) error
Kick kicks this member.
If revokeHistory is set, will delete all messages from this member.
func (ChatMember) Raw ¶
func (c ChatMember) Raw() tg.ChatParticipantClass
Raw returns raw member object.
type ChatMembers ¶
type ChatMembers struct {
// contains filtered or unexported fields
}
ChatMembers is chat Members.
func (*ChatMembers) Count ¶
func (c *ChatMembers) Count(ctx context.Context) (int, error)
Count returns total count of members.
func (*ChatMembers) EditAdmin ¶
func (c *ChatMembers) EditAdmin(ctx context.Context, user tg.InputUserClass, isAdmin bool) error
EditAdmin edits admin rights for given user.
func (*ChatMembers) EditRights ¶
func (c *ChatMembers) EditRights(ctx context.Context, options MemberRights) error
EditRights edits rights of all members in this chat.
func (*ChatMembers) ForEach ¶
func (c *ChatMembers) ForEach(ctx context.Context, cb Callback) error
ForEach calls cb for every member of chat.
May return ChatInfoUnavailableError.
func (*ChatMembers) Kick ¶
func (c *ChatMembers) Kick(ctx context.Context, member tg.InputUserClass, revokeHistory bool) error
Kick kicks user member.
If revokeHistory is set, will delete all messages from this member.
type Member ¶
type Member interface { // Status returns member Status. Status() Status // JoinDate returns member join date, if it is available. JoinDate() (time.Time, bool) // InvitedBy returns user that invited this member. InvitedBy() (peers.User, bool) // User returns member User object. User() peers.User // Kick kicks this member. // // If revokeHistory is set, will delete all messages from this member. Kick(ctx context.Context, revokeHistory bool) error }
Member represents chat/channel member.
type MemberRights ¶
type MemberRights struct { // If set, does not allow a user to view messages in a supergroup/channel/chat. // // In fact, user will be kicked. DenyViewMessages bool // If set, does not allow a user to send messages in a supergroup/chat. DenySendMessages bool // If set, does not allow a user to send any media in a supergroup/chat. DenySendMedia bool // If set, does not allow a user to send stickers in a supergroup/chat. DenySendStickers bool // If set, does not allow a user to send gifs in a supergroup/chat. DenySendGifs bool // If set, does not allow a user to send games in a supergroup/chat. DenySendGames bool // If set, does not allow a user to use inline bots in a supergroup/chat. DenySendInline bool // If set, does not allow a user to embed links in the messages of a supergroup/chat. DenyEmbedLinks bool // If set, does not allow a user to send polls in a supergroup/chat. DenySendPolls bool // If set, does not allow any user to change the description of a supergroup/chat. DenyChangeInfo bool // If set, does not allow any user to invite users in a supergroup/chat. DenyInviteUsers bool // If set, does not allow any user to pin messages in a supergroup/chat. DenyPinMessages bool // Validity of said permissions (it is considered forever any value less than 30 seconds or more than 366 days). // // If value is zero, value will not be used. UntilDate time.Time }
MemberRights represents member right settings.
func (*MemberRights) ApplyFor ¶
func (b *MemberRights) ApplyFor(d time.Duration)
ApplyFor sets duration of validity of set rights.
func (MemberRights) IntoChatBannedRights ¶
func (b MemberRights) IntoChatBannedRights() (r tg.ChatBannedRights)
IntoChatBannedRights converts MemberRights into tg.ChatBannedRights.
type Members ¶
type Members interface { // ForEach calls cb for every member of chat/channel. ForEach(ctx context.Context, cb Callback) error // Count returns total count of members. Count(ctx context.Context) (int, error) // Peer returns chat object. Peer() peers.Peer // Kick kicks user member. // // If revokeHistory is set, will delete all messages from this member. Kick(ctx context.Context, member tg.InputUserClass, revokeHistory bool) error // EditRights edits rights of all members in this chat/channel. EditRights(ctx context.Context, options MemberRights) error }
Members represents chat/channel members.