await prune task of deleting messages
There was an issue where it would sometimes delete once or twice or sometimes does not delete at all or would return 404 error
This commit is contained in:
parent
240e242eaf
commit
149a9e49bc
@ -643,7 +643,7 @@ namespace NadekoBot.Modules.Administration
|
|||||||
|
|
||||||
var enumerable = (await umsg.Channel.GetMessagesAsync()).AsEnumerable();
|
var enumerable = (await umsg.Channel.GetMessagesAsync()).AsEnumerable();
|
||||||
enumerable = enumerable.Where(x => x.Author.Id == user.Id);
|
enumerable = enumerable.Where(x => x.Author.Id == user.Id);
|
||||||
await umsg.Channel.DeleteMessagesAsync(enumerable);
|
await umsg.Channel.DeleteMessagesAsync(enumerable).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// prune x
|
// prune x
|
||||||
@ -656,7 +656,7 @@ namespace NadekoBot.Modules.Administration
|
|||||||
await (msg as IUserMessage).DeleteAsync();
|
await (msg as IUserMessage).DeleteAsync();
|
||||||
int limit = (count < 100) ? count : 100;
|
int limit = (count < 100) ? count : 100;
|
||||||
var enumerable = (await msg.Channel.GetMessagesAsync(limit: limit));
|
var enumerable = (await msg.Channel.GetMessagesAsync(limit: limit));
|
||||||
await msg.Channel.DeleteMessagesAsync(enumerable);
|
await msg.Channel.DeleteMessagesAsync(enumerable).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//prune @user [x]
|
//prune @user [x]
|
||||||
@ -668,7 +668,7 @@ namespace NadekoBot.Modules.Administration
|
|||||||
var channel = (ITextChannel)msg.Channel;
|
var channel = (ITextChannel)msg.Channel;
|
||||||
int limit = (count < 100) ? count : 100;
|
int limit = (count < 100) ? count : 100;
|
||||||
var enumerable = (await msg.Channel.GetMessagesAsync(limit: limit)).Where(m => m.Author == user);
|
var enumerable = (await msg.Channel.GetMessagesAsync(limit: limit)).Where(m => m.Author == user);
|
||||||
await msg.Channel.DeleteMessagesAsync(enumerable);
|
await msg.Channel.DeleteMessagesAsync(enumerable).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
|
Loading…
Reference in New Issue
Block a user