Browse Source

Fox doesn't like module-wide switches 😒

pull/998/head
Joe4evr 8 years ago
parent
commit
c79144fae3
6 changed files with 2 additions and 28 deletions
  1. +1
    -0
      src/Discord.Net.Commands/Attributes/CommandAttribute.cs
  2. +0
    -17
      src/Discord.Net.Commands/Attributes/IgnoreExtraArgsAttribute.cs
  3. +0
    -1
      src/Discord.Net.Commands/Builders/CommandBuilder.cs
  4. +0
    -2
      src/Discord.Net.Commands/Builders/ModuleBuilder.cs
  5. +1
    -6
      src/Discord.Net.Commands/Builders/ModuleClassBuilder.cs
  6. +0
    -2
      src/Discord.Net.Commands/Info/ModuleInfo.cs

+ 1
- 0
src/Discord.Net.Commands/Attributes/CommandAttribute.cs View File

@@ -7,6 +7,7 @@ namespace Discord.Commands
{ {
public string Text { get; } public string Text { get; }
public RunMode RunMode { get; set; } = RunMode.Default; public RunMode RunMode { get; set; } = RunMode.Default;
public bool? IgnoreExtraArgs { get; set; }


public CommandAttribute() public CommandAttribute()
{ {


+ 0
- 17
src/Discord.Net.Commands/Attributes/IgnoreExtraArgsAttribute.cs View File

@@ -1,17 +0,0 @@
using System;

namespace Discord.Commands
{
/// <summary> Set whether or not to ignore extra arguments for an individual command method or module,
/// overriding the setting in <see cref="CommandServiceConfig"/> if necessary. </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public sealed class IgnoreExtraArgsAttribute : Attribute
{
public bool IgnoreValue { get; }

public IgnoreExtraArgsAttribute(bool ignoreValue)
{
IgnoreValue = ignoreValue;
}
}
}

+ 0
- 1
src/Discord.Net.Commands/Builders/CommandBuilder.cs View File

@@ -32,7 +32,6 @@ namespace Discord.Commands.Builders
internal CommandBuilder(ModuleBuilder module) internal CommandBuilder(ModuleBuilder module)
{ {
Module = module; Module = module;
IgnoreExtraArgs = module.IgnoreExtraArgs;


_preconditions = new List<PreconditionAttribute>(); _preconditions = new List<PreconditionAttribute>();
_parameters = new List<ParameterBuilder>(); _parameters = new List<ParameterBuilder>();


+ 0
- 2
src/Discord.Net.Commands/Builders/ModuleBuilder.cs View File

@@ -19,7 +19,6 @@ namespace Discord.Commands.Builders
public string Summary { get; set; } public string Summary { get; set; }
public string Remarks { get; set; } public string Remarks { get; set; }
public string Group { get; set; } public string Group { get; set; }
public bool IgnoreExtraArgs { get; set; }


public IReadOnlyList<CommandBuilder> Commands => _commands; public IReadOnlyList<CommandBuilder> Commands => _commands;
public IReadOnlyList<ModuleBuilder> Modules => _submodules; public IReadOnlyList<ModuleBuilder> Modules => _submodules;
@@ -34,7 +33,6 @@ namespace Discord.Commands.Builders
{ {
Service = service; Service = service;
Parent = parent; Parent = parent;
IgnoreExtraArgs = service._ignoreExtraArgs;


_commands = new List<CommandBuilder>(); _commands = new List<CommandBuilder>();
_submodules = new List<ModuleBuilder>(); _submodules = new List<ModuleBuilder>();


+ 1
- 6
src/Discord.Net.Commands/Builders/ModuleClassBuilder.cs View File

@@ -123,9 +123,6 @@ namespace Discord.Commands
case PreconditionAttribute precondition: case PreconditionAttribute precondition:
builder.AddPrecondition(precondition); builder.AddPrecondition(precondition);
break; break;
case IgnoreExtraArgsAttribute ignoreExtra:
builder.IgnoreExtraArgs = ignoreExtra.IgnoreValue;
break;
default: default:
builder.AddAttributes(attribute); builder.AddAttributes(attribute);
break; break;
@@ -161,6 +158,7 @@ namespace Discord.Commands
builder.AddAliases(command.Text); builder.AddAliases(command.Text);
builder.RunMode = command.RunMode; builder.RunMode = command.RunMode;
builder.Name = builder.Name ?? command.Text; builder.Name = builder.Name ?? command.Text;
builder.IgnoreExtraArgs = command.IgnoreExtraArgs ?? service._ignoreExtraArgs;
break; break;
case NameAttribute name: case NameAttribute name:
builder.Name = name.Text; builder.Name = name.Text;
@@ -180,9 +178,6 @@ namespace Discord.Commands
case PreconditionAttribute precondition: case PreconditionAttribute precondition:
builder.AddPrecondition(precondition); builder.AddPrecondition(precondition);
break; break;
case IgnoreExtraArgsAttribute ignoreExtra:
builder.IgnoreExtraArgs = ignoreExtra.IgnoreValue;
break;
default: default:
builder.AddAttributes(attribute); builder.AddAttributes(attribute);
break; break;


+ 0
- 2
src/Discord.Net.Commands/Info/ModuleInfo.cs View File

@@ -13,7 +13,6 @@ namespace Discord.Commands
public string Summary { get; } public string Summary { get; }
public string Remarks { get; } public string Remarks { get; }
public string Group { get; } public string Group { get; }
public bool IgnoreExtraArgs { get; }


public IReadOnlyList<string> Aliases { get; } public IReadOnlyList<string> Aliases { get; }
public IReadOnlyList<CommandInfo> Commands { get; } public IReadOnlyList<CommandInfo> Commands { get; }
@@ -31,7 +30,6 @@ namespace Discord.Commands
Summary = builder.Summary; Summary = builder.Summary;
Remarks = builder.Remarks; Remarks = builder.Remarks;
Group = builder.Group; Group = builder.Group;
IgnoreExtraArgs = builder.IgnoreExtraArgs;
Parent = parent; Parent = parent;


Aliases = BuildAliases(builder, service).ToImmutableArray(); Aliases = BuildAliases(builder, service).ToImmutableArray();


Loading…
Cancel
Save