blockedChatMembers method
Future<Map>
blockedChatMembers({
- required dynamic chat_id,
- bool is_delete_chat_history = false,
- bool remove_from_chat_list = false,
- bool revoke = false,
- bool is_blocked = true,
- required int clientId,
- bool isVoid = false,
- Duration? delayDuration,
- Duration? delayLoop,
- Duration? invokeTimeOut,
- String? extra,
- dynamic onProcces()?,
- bool? isUseCache,
- Duration? durationCacheExpire,
delete chat history
Implementation
Future<Map> blockedChatMembers({
required chat_id,
bool is_delete_chat_history = false,
bool remove_from_chat_list = false,
bool revoke = false,
bool is_blocked = true,
required int clientId,
bool isVoid = false,
Duration? delayDuration,
Duration? delayLoop,
Duration? invokeTimeOut,
String? extra,
dynamic Function(Map data, int client_id)? onProcces,
bool? isUseCache,
Duration? durationCacheExpire,
}) async {
delayLoop ??= Duration(milliseconds: 500);
Map members = await getAllMembers(
chat_id: chat_id,
clientId: clientId,
onProcces: onProcces,
isUseCache: isUseCache,
durationCacheExpire: durationCacheExpire,
);
late Map jsonRespond = {
"@type": "users",
"users": [],
};
if (members["user_ids"] is List) {
late List<Map> users = [];
List<int> member_user_ids = (members["user_ids"] as List).cast<int>();
for (var i = 0; i < member_user_ids.length; i++) {
int user_id = member_user_ids[i];
await Future.delayed(delayLoop);
try {
Map toggle_message_sender_is_blocked =
await toggleMessageSenderIsBlocked(
user_id: user_id,
is_blocked: is_blocked,
clientId: clientId,
isVoid: isVoid,
isUseCache: isUseCache,
durationCacheExpire: durationCacheExpire,
);
toggle_message_sender_is_blocked["user_id"] = user_id;
users.add(toggle_message_sender_is_blocked);
if (is_delete_chat_history) {
await Future.delayed(delayLoop);
try {
await deleteChatHistory(
chat_id: user_id,
remove_from_chat_list: remove_from_chat_list,
revoke: revoke,
clientId: clientId,
isVoid: isVoid,
isUseCache: isUseCache,
durationCacheExpire: durationCacheExpire,
);
} catch (e) {}
}
} catch (e) {
users.add({"@type": "error", "user_id": user_id});
}
}
try {
jsonRespond["users"] = users;
} catch (e) {}
}
return jsonRespond;
}