diff options
author | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2022-07-08 03:38:06 +0300 |
---|---|---|
committer | Bohdan Horbeshko <bodqhrohro@gmail.com> | 2022-07-08 03:38:06 +0300 |
commit | 6abb7ff9c238f0343351c15c09210d746086f5f6 (patch) | |
tree | 9d0f97cca26997cba7ac1c7fd308ae289baa35ab /telegram | |
parent | afa21e10be45a6186b99a33e4d8f22d820677efb (diff) |
Respond to disco with conference identity and groups list
Diffstat (limited to 'telegram')
-rw-r--r-- | telegram/utils.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/telegram/utils.go b/telegram/utils.go index 17e9861..7747acb 100644 --- a/telegram/utils.go +++ b/telegram/utils.go @@ -1065,6 +1065,30 @@ func (c *Client) GetChatDescription(chat *client.Chat) string { return "" } +// GetGroupChats obtains all group chats +func (c *Client) GetGroupChats() []*client.Chat { + var groupChats []*client.Chat + + chats, err := c.client.GetChats(&client.GetChatsRequest{ + Limit: chatsLimit, + }) + if err == nil { + for _, id := range chats.ChatIds { + chat, _, _ := c.GetContactByID(id, nil) + if chat != nil { + typ := chat.Type.ChatTypeType() + if typ == client.TypeChatTypeBasicGroup { + groupChats = append(groupChats, chat) + } + } + } + } else { + log.Errorf("Could not retrieve chats: %v", err) + } + + return groupChats +} + // subscribe to a Telegram ID func (c *Client) subscribeToID(id int64, chat *client.Chat) { var args []args.V |