.prune @someone x fixed

This commit is contained in:
Master Kwoth 2017-06-14 12:37:23 +02:00
parent 7aa06f3631
commit eadcde8397
2 changed files with 7 additions and 5 deletions

View File

@ -359,12 +359,14 @@ namespace NadekoBot.Modules.Administration
if (count < 1) if (count < 1)
return; return;
if (count > 100)
count = 100;
if (user.Id == Context.User.Id) if (user.Id == Context.User.Id)
count += 1; count += 1;
var enumerable = (await Context.Channel.GetMessagesAsync().Flatten())
int limit = (count < 100) ? count : 100; .Where(m => m.Author.Id == user.Id && DateTime.UtcNow - m.CreatedAt < twoWeeks)
var enumerable = (await Context.Channel.GetMessagesAsync(limit: limit).Flatten()) .Take(count);
.Where(m => m.Author == user && DateTime.UtcNow - m.CreatedAt < twoWeeks);
await Context.Channel.DeleteMessagesAsync(enumerable).ConfigureAwait(false); await Context.Channel.DeleteMessagesAsync(enumerable).ConfigureAwait(false);
Context.Message.DeleteAfter(3); Context.Message.DeleteAfter(3);

View File

@ -290,7 +290,7 @@
"help_cmdlist_donate": "You can support the project on patreon: <{0}> or paypal: <{1}>", "help_cmdlist_donate": "You can support the project on patreon: <{0}> or paypal: <{1}>",
"help_cmd_and_alias": "Commands and aliases", "help_cmd_and_alias": "Commands and aliases",
"help_commandlist_regen": "Commandlist regenerated.", "help_commandlist_regen": "Commandlist regenerated.",
"help_commands_instr": "Type `{0}h CommandName` to see the help for that specified command. e.g. `{0}h >8ball`", "help_commands_instr": "Type `{0}h CommandName` to see the help for that specified command. e.g. `{0}h {0}8ball`",
"help_command_not_found": "I can't find that command. Please verify that the command exists before trying again.", "help_command_not_found": "I can't find that command. Please verify that the command exists before trying again.",
"help_desc": "Description", "help_desc": "Description",
"help_donate": "You can support the NadekoBot project on \nPatreon <{0}> or\nPaypal <{1}>\nDon't forget to leave your discord name or id in the message.\n\n**Thank you** ♥️", "help_donate": "You can support the NadekoBot project on \nPatreon <{0}> or\nPaypal <{1}>\nDon't forget to leave your discord name or id in the message.\n\n**Thank you** ♥️",