7a04f298d2
- update to latest telegram layer - remove some references to fields in tg.Entities that don't exist in the schema - originally added here: https://github.com/beeper/td/commit/820929062a2ba0104397bc01235ab58a9cff780e - referenced here - https://github.com/mautrix/telegramgo/commit/124f0967ed195b5a380c9bd02e170ada9710dde3 - https://github.com/mautrix/telegramgo/commit/4205047aab2e0639217148b5d125bfaab668bd8e
60 lines
1.6 KiB
Go
60 lines
1.6 KiB
Go
package members
|
|
|
|
import (
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/telegram/peers"
|
|
"go.mau.fi/mautrix-telegram/pkg/gotd/tg"
|
|
)
|
|
|
|
// ChannelQuery is builder for channel members querying.
|
|
type ChannelQuery struct {
|
|
Channel peers.Channel
|
|
}
|
|
|
|
func (q ChannelQuery) query(filter tg.ChannelParticipantsFilterClass) *ChannelMembers {
|
|
return &ChannelMembers{
|
|
m: q.Channel.Manager(),
|
|
filter: filter,
|
|
channel: q.Channel,
|
|
}
|
|
}
|
|
|
|
// Recent queries recent members.
|
|
func (q ChannelQuery) Recent() *ChannelMembers {
|
|
return q.query(&tg.ChannelParticipantsRecent{})
|
|
}
|
|
|
|
// Admins queries admins members.
|
|
func (q ChannelQuery) Admins() *ChannelMembers {
|
|
return q.query(&tg.ChannelParticipantsAdmins{})
|
|
}
|
|
|
|
// Kicked queries kicked members.
|
|
func (q ChannelQuery) Kicked(query string) *ChannelMembers {
|
|
return q.query(&tg.ChannelParticipantsKicked{Q: query})
|
|
}
|
|
|
|
// Bots queries bots members.
|
|
func (q ChannelQuery) Bots() *ChannelMembers {
|
|
return q.query(&tg.ChannelParticipantsBots{})
|
|
}
|
|
|
|
// Banned queries banned members.
|
|
func (q ChannelQuery) Banned(query string) *ChannelMembers {
|
|
return q.query(&tg.ChannelParticipantsBanned{Q: query})
|
|
}
|
|
|
|
// Search queries members by given name.
|
|
func (q ChannelQuery) Search(query string) *ChannelMembers {
|
|
return q.query(&tg.ChannelParticipantsSearch{Q: query})
|
|
}
|
|
|
|
// Contacts queries members that are also contacts.
|
|
func (q ChannelQuery) Contacts(query string) *ChannelMembers {
|
|
return q.query(&tg.ChannelParticipantsContacts{Q: query})
|
|
}
|
|
|
|
// Custom creates query with custom filter.
|
|
func (q ChannelQuery) Custom(filter tg.ChannelParticipantsFilterClass) *ChannelMembers {
|
|
return q.query(filter)
|
|
}
|