MyChat Scripts Engine: mGetUsersListInGroupByName
Function to obtain a list of user unique identifiers (UIN) from a group by name.
Syntax
function mGetUsersListInGroupByName(sGroupName: string): string;
Parameters and return values
Parameter |
Type |
Value |
sGroupName |
string |
users group name. The letter case is important. |
Function result
A text string with a list of users UINs, who are members of a group, divided by commas. If the group does not exist or empty, then the function returns an empty string.
Example
const
Group1 = 'Co-worker';
Group2 = 'blocked users';
function GetUsersList(sUINsList: string): string;
var
sData, sUIN, sDisplayName, sResult: string;
begin
sData := sUINsList;
sResult := '';
while length(sData) > 0 do begin
sUIN := GetNextSt(sData, ',');
sDisplayName := mGetUserAttribute(StrToIntDef(sUIN, 0), 'DisplayName');
sResult := sResult + CRLF + 'UIN ' + sUIN + ' - ' + sDisplayName;
end;
result := sResult;
end;
begin
mLogScript(GetUsersList(mGetUsersListInGroupByName(Group1)), 'Group1');
mLogScript(GetUsersList(mGetUsersListInGroupByName(Group2)), 'Group2');
end.
Script work result
[14:28:19] (Log "mGetUsersListInGroupByName"): [Group1]
UIN 15427 - George O'Brien
UIN 15571 - Alex Tompson
UIN 16031 - Max Lewis
UIN 3 - Andrew Hutcherson
UIN 6 - Liam Shelton
[14:28:19] (Log "mGetUsersListInGroupByName"): [Group2]
[14:28:19] (Run "mGetUsersListInGroupByName"): Script operation time: 2 ms
[14:28:19] (Run "mGetUsersListInGroupByName"): Script done successfully.