0

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();
}
Moslem7026
  • 3,290
  • 6
  • 40
  • 51

1 Answers1

0

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)

Wizou
  • 1,336
  • 13
  • 24
  • it retun just 9 Result and has no any pagination, Screenshot : [Image](https://i.stack.imgur.com/TYiNs.jpg) but `Messages_SearchGlobal` return limted global search just like official telegram application :[Official](https://i.stack.imgur.com/R50mW.jpg) . `Messages_SearchGlobal` has pagination and `Contacts_Search` has no pagination. – Moslem7026 Jul 25 '23 at 08:32
  • Yes, usually you can't do more with API calls than what you can do in official Telegram app. – Wizou Jul 26 '23 at 12:20
  • i didnt find any solution yet , for getting more poulic search in telegram channel and account , is there any full sample ? – Moslem7026 Jul 26 '23 at 14:15