public async Task AdminCleanupAsync(long chatId) { var admins = await _botClient.GetChatAdministratorsAsync(chatId); var demoted = new List <ChatMember>(); await admins.ForEachAsync( 6, async chatMember => { var userId = chatMember.User.Id; Log.Debug( "Demoting UserId: {UserId} at ChatId: {ChatId}", userId, chatId ); try { await _botClient.PromoteChatMemberAsync(chatId, userId); demoted.Add(chatMember); } catch (Exception exception) { Log.Warning( "Error when Demoting UserId: {UserId}. Exception: {Message}", userId, exception.Message ); } } ); var messageBuilder = new StringBuilder(); messageBuilder.Append("Jadwal ganti petugas, silakan /promote kembali jika di perlukan") .AppendLine() .AppendLine(); if (!demoted.Any()) { return; } demoted.ForEach( ( chatMember, index ) => { var number = index + 1; var nameLink = chatMember.User.GetNameLink(); messageBuilder.Append(number).Append(". ").AppendLine(nameLink); } ); await _botClient.SendTextMessageAsync( chatId : chatId, text : messageBuilder.ToTrimmedString(), parseMode : ParseMode.Html ); }