Fix issues with DefaultRunMode

For a command to use the DefaultRunMode, it must now have it's RunMode set to RunMode.Default (this is the default value on CommandAttribute now).
This commit is contained in:
Christopher F
2016-11-26 22:04:02 -05:00
parent 1be6f77efb
commit fb99b019a0
4 changed files with 4 additions and 3 deletions

View File

@@ -6,7 +6,7 @@ namespace Discord.Commands
public class CommandAttribute : Attribute public class CommandAttribute : Attribute
{ {
public string Text { get; } public string Text { get; }
public RunMode RunMode { get; set; } public RunMode RunMode { get; set; } = RunMode.Default;
public CommandAttribute() public CommandAttribute()
{ {

View File

@@ -17,7 +17,7 @@ namespace Discord.Commands.Builders
public string Name { get; set; } public string Name { get; set; }
public string Summary { get; set; } public string Summary { get; set; }
public string Remarks { get; set; } public string Remarks { get; set; }
public RunMode? RunMode { get; set; } public RunMode RunMode { get; set; }
public int Priority { get; set; } public int Priority { get; set; }
public IReadOnlyList<PreconditionAttribute> Preconditions => _preconditions; public IReadOnlyList<PreconditionAttribute> Preconditions => _preconditions;

View File

@@ -37,7 +37,7 @@ namespace Discord.Commands
Summary = builder.Summary; Summary = builder.Summary;
Remarks = builder.Remarks; Remarks = builder.Remarks;
RunMode = builder.RunMode ?? service._defaultRunMode; RunMode = (builder.RunMode == RunMode.Default ? service._defaultRunMode : builder.RunMode);
Priority = builder.Priority; Priority = builder.Priority;
if (module.Aliases.Count != 0) if (module.Aliases.Count != 0)

View File

@@ -2,6 +2,7 @@
{ {
public enum RunMode public enum RunMode
{ {
Default,
Sync, Sync,
Mixed, Mixed,
Async Async