mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 01:38:27 -04:00
Using new .Chunk and .DistinctBy Linq Extensions
This commit is contained in:
@@ -30,7 +30,7 @@ public partial class Administration
|
||||
|
||||
var grp = 0;
|
||||
var results = input
|
||||
.GroupBy(x => grp++ / 2)
|
||||
.Chunk(input.Length / 2)
|
||||
.Select(async x =>
|
||||
{
|
||||
var inputRoleStr = x.First();
|
||||
|
@@ -47,8 +47,7 @@ public class PruneService : INService
|
||||
if (bulkDeletable.Count > 0)
|
||||
await Task.WhenAll(Task.Delay(1000), channel.DeleteMessagesAsync(bulkDeletable)).ConfigureAwait(false);
|
||||
|
||||
var i = 0;
|
||||
foreach (var group in singleDeletable.GroupBy(x => ++i / (singleDeletable.Count / 5)))
|
||||
foreach (var group in singleDeletable.Chunk(5))
|
||||
await Task.WhenAll(Task.Delay(1000), Task.WhenAll(group.Select(x => x.DeleteAsync()))).ConfigureAwait(false);
|
||||
|
||||
//this isn't good, because this still work as if i want to remove only specific user's messages from the last
|
||||
|
Reference in New Issue
Block a user