Telegram API allows to get information about members of a SuperGroup. Use the method GetSuperGroupMembers to get information about members or banned users in a supergroup or channel. Can be used only if SupergroupFullInfo.can_get_members is true; additionally, administrator privileges may be required for some filters.
By default the method returns All members of the group, but you can filter the members returned using the Filter parameter. From sgcWebSockets 4.5.0 this method has been improved to allow to filter the members using a set of parameters.
Filters
There are the following parameters:
- tsgmFilterNone: Default value, means members are not filtered.
- tsgmFilterAdministrators: Returns the creator and administrators.
- tsgmFilterBanned: Returns users banned from the supergroup or channel; can be used only by administrators. You can use the argument aSuperGroupMembersQuery to search using a query.
- tsgmFilterBots: Returns bot members of the supergroup or channel.
- tsgmFilterContacts: Returns contacts of the user, which are members of the supergroup or channel. You can use the argument aSuperGroupMembersQuery to search using a query.
- tsgmFilterMention: Returns users which can be mentioned in the supergroup.
- tsgmFilterRecent: Returns recently active users in reverse chronological order.
- tsgmFilterRestricted: Returns restricted supergroup members; can be used only by administrators. You can use the argument aSuperGroupMembersQuery to search using a query.
- tsgmFilterSearch: Used to search for supergroup or channel members via a (string) query. You can use the argument aSuperGroupMembersQuery to search using a query.
You can read the result of the result using OnEvent callback and filtering by event = "chatMembers".
Telegram.GetSupergroupMembers(1452979380);
procedure OnTelegramEvent(Sender: TObject; const Event, Text: string);
begin
if Event = 'chatMembers' then
ReadJSON(Text);
end;