From c79144fae3cbb25ecec0bc42286de9ac124c178e Mon Sep 17 00:00:00 2001 From: Joe4evr Date: Sun, 25 Mar 2018 22:49:42 +0200 Subject: [PATCH] =?UTF-8?q?Fox=20doesn't=20like=20module-wide=20switches?= =?UTF-8?q?=20=F0=9F=98=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Attributes/CommandAttribute.cs | 1 + .../Attributes/IgnoreExtraArgsAttribute.cs | 17 ----------------- .../Builders/CommandBuilder.cs | 1 - .../Builders/ModuleBuilder.cs | 2 -- .../Builders/ModuleClassBuilder.cs | 7 +------ src/Discord.Net.Commands/Info/ModuleInfo.cs | 2 -- 6 files changed, 2 insertions(+), 28 deletions(-) delete mode 100644 src/Discord.Net.Commands/Attributes/IgnoreExtraArgsAttribute.cs diff --git a/src/Discord.Net.Commands/Attributes/CommandAttribute.cs b/src/Discord.Net.Commands/Attributes/CommandAttribute.cs index 5f8e9ceaf..a0fcf3e4a 100644 --- a/src/Discord.Net.Commands/Attributes/CommandAttribute.cs +++ b/src/Discord.Net.Commands/Attributes/CommandAttribute.cs @@ -7,6 +7,7 @@ namespace Discord.Commands { public string Text { get; } public RunMode RunMode { get; set; } = RunMode.Default; + public bool? IgnoreExtraArgs { get; set; } public CommandAttribute() { diff --git a/src/Discord.Net.Commands/Attributes/IgnoreExtraArgsAttribute.cs b/src/Discord.Net.Commands/Attributes/IgnoreExtraArgsAttribute.cs deleted file mode 100644 index c359e8287..000000000 --- a/src/Discord.Net.Commands/Attributes/IgnoreExtraArgsAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; - -namespace Discord.Commands -{ - /// Set whether or not to ignore extra arguments for an individual command method or module, - /// overriding the setting in if necessary. - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] - public sealed class IgnoreExtraArgsAttribute : Attribute - { - public bool IgnoreValue { get; } - - public IgnoreExtraArgsAttribute(bool ignoreValue) - { - IgnoreValue = ignoreValue; - } - } -} diff --git a/src/Discord.Net.Commands/Builders/CommandBuilder.cs b/src/Discord.Net.Commands/Builders/CommandBuilder.cs index 7911e0703..17a170775 100644 --- a/src/Discord.Net.Commands/Builders/CommandBuilder.cs +++ b/src/Discord.Net.Commands/Builders/CommandBuilder.cs @@ -32,7 +32,6 @@ namespace Discord.Commands.Builders internal CommandBuilder(ModuleBuilder module) { Module = module; - IgnoreExtraArgs = module.IgnoreExtraArgs; _preconditions = new List(); _parameters = new List(); diff --git a/src/Discord.Net.Commands/Builders/ModuleBuilder.cs b/src/Discord.Net.Commands/Builders/ModuleBuilder.cs index d774de716..0ada5a9c2 100644 --- a/src/Discord.Net.Commands/Builders/ModuleBuilder.cs +++ b/src/Discord.Net.Commands/Builders/ModuleBuilder.cs @@ -19,7 +19,6 @@ namespace Discord.Commands.Builders public string Summary { get; set; } public string Remarks { get; set; } public string Group { get; set; } - public bool IgnoreExtraArgs { get; set; } public IReadOnlyList Commands => _commands; public IReadOnlyList Modules => _submodules; @@ -34,7 +33,6 @@ namespace Discord.Commands.Builders { Service = service; Parent = parent; - IgnoreExtraArgs = service._ignoreExtraArgs; _commands = new List(); _submodules = new List(); diff --git a/src/Discord.Net.Commands/Builders/ModuleClassBuilder.cs b/src/Discord.Net.Commands/Builders/ModuleClassBuilder.cs index 58e55d76d..ba97ad700 100644 --- a/src/Discord.Net.Commands/Builders/ModuleClassBuilder.cs +++ b/src/Discord.Net.Commands/Builders/ModuleClassBuilder.cs @@ -123,9 +123,6 @@ namespace Discord.Commands case PreconditionAttribute precondition: builder.AddPrecondition(precondition); break; - case IgnoreExtraArgsAttribute ignoreExtra: - builder.IgnoreExtraArgs = ignoreExtra.IgnoreValue; - break; default: builder.AddAttributes(attribute); break; @@ -161,6 +158,7 @@ namespace Discord.Commands builder.AddAliases(command.Text); builder.RunMode = command.RunMode; builder.Name = builder.Name ?? command.Text; + builder.IgnoreExtraArgs = command.IgnoreExtraArgs ?? service._ignoreExtraArgs; break; case NameAttribute name: builder.Name = name.Text; @@ -180,9 +178,6 @@ namespace Discord.Commands case PreconditionAttribute precondition: builder.AddPrecondition(precondition); break; - case IgnoreExtraArgsAttribute ignoreExtra: - builder.IgnoreExtraArgs = ignoreExtra.IgnoreValue; - break; default: builder.AddAttributes(attribute); break; diff --git a/src/Discord.Net.Commands/Info/ModuleInfo.cs b/src/Discord.Net.Commands/Info/ModuleInfo.cs index 02cac00a6..7c144599b 100644 --- a/src/Discord.Net.Commands/Info/ModuleInfo.cs +++ b/src/Discord.Net.Commands/Info/ModuleInfo.cs @@ -13,7 +13,6 @@ namespace Discord.Commands public string Summary { get; } public string Remarks { get; } public string Group { get; } - public bool IgnoreExtraArgs { get; } public IReadOnlyList Aliases { get; } public IReadOnlyList Commands { get; } @@ -31,7 +30,6 @@ namespace Discord.Commands Summary = builder.Summary; Remarks = builder.Remarks; Group = builder.Group; - IgnoreExtraArgs = builder.IgnoreExtraArgs; Parent = parent; Aliases = BuildAliases(builder, service).ToImmutableArray();