Global Search in groups return Limited Result

759 Views Asked by At

this code search in telegram globally and return Groups

var t = ((await  client.Messages_SearchGlobal("Keyword")) as Messages_MessagesSlice).chats.Where(q=>q.Value.IsGroup).ToList();

but it returns limited result (just 5 group) . also we know that there are more GROUPS in telegram with this keyword. how fetch all groups or more in telegram Api ?

Edit:

adding Limit and offset also return limited result and Duplicate Result:

var asdfdsf = ((await  client.Messages_SearchGlobal("Keyword",limit:20)) as Messages_MessagesSlice);
            while (asdfdsf.flags== Messages_MessagesSlice.Flags.has_next_rate)
            {
                asdfdsf = ((await client.Messages_SearchGlobal("Keyword", offset_rate: asdfdsf.next_rate, limit: 20)) as Messages_MessagesSlice);
                var asdfdsfsdf = asdfdsf.chats.Where(q => 

q.Value.IsGroup).ToList();
}
1

There are 1 best solutions below

3
On

Messages_SearchGlobal is used to search within messages from the group/channel the user has already joined.

The method you're looking for is Contacts_Search which returns public groups & channels (& users) having a given name (including some partial match)