From f5f0f1e25048c1aaa5b22289e6cb2472a0815028 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Tue, 25 Oct 2022 02:07:05 +0200 Subject: [PATCH] Fixed .prune @Target not working bug --- src/NadekoBot/Common/OptionsParser.cs | 7 +++---- .../Modules/Administration/Prune/PruneCommands.cs | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/NadekoBot/Common/OptionsParser.cs b/src/NadekoBot/Common/OptionsParser.cs index a88ee1524..465e8dc89 100644 --- a/src/NadekoBot/Common/OptionsParser.cs +++ b/src/NadekoBot/Common/OptionsParser.cs @@ -1,15 +1,14 @@ -#nullable disable -using CommandLine; +using CommandLine; namespace NadekoBot.Common; public static class OptionsParser { - public static T ParseFrom(string[] args) + public static T ParseFrom(string[]? args) where T : INadekoCommandOptions, new() => ParseFrom(new T(), args).Item1; - public static (T, bool) ParseFrom(T options, string[] args) + public static (T, bool) ParseFrom(T options, string[]? args) where T : INadekoCommandOptions { using var p = new Parser(x => diff --git a/src/NadekoBot/Modules/Administration/Prune/PruneCommands.cs b/src/NadekoBot/Modules/Administration/Prune/PruneCommands.cs index 85c44dad6..9fa1f4cbb 100644 --- a/src/NadekoBot/Modules/Administration/Prune/PruneCommands.cs +++ b/src/NadekoBot/Modules/Administration/Prune/PruneCommands.cs @@ -72,7 +72,7 @@ public partial class Administration [BotPerm(ChannelPerm.ManageMessages)] [NadekoOptions(typeof(PruneOptions))] [Priority(0)] - public Task Prune(IGuildUser user, int count = 100, string args = null) + public Task Prune(IGuildUser user, int count = 100, params string[] args) => Prune(user.Id, count, args); //prune userid [x]