Browse Source

Remove ContextType.Invalid

pull/179/head
Finite Reality 9 years ago
parent
commit
c77c84bec7
1 changed files with 0 additions and 7 deletions
  1. +0
    -7
      src/Discord.Net.Commands/Attributes/Preconditions/RequireContextAttribute.cs

+ 0
- 7
src/Discord.Net.Commands/Attributes/Preconditions/RequireContextAttribute.cs View File

@@ -8,7 +8,6 @@ namespace Discord.Commands
[Flags] [Flags]
public enum ContextType public enum ContextType
{ {
Invalid = 0, // 00
Guild = 1, // 01 Guild = 1, // 01
DM = 2 // 10 DM = 2 // 10
} }
@@ -22,18 +21,12 @@ namespace Discord.Commands
public RequireContextAttribute(ContextType context) public RequireContextAttribute(ContextType context)
{ {
Context = context; Context = context;

if (Context == ContextType.Invalid)
throw new ArgumentException("Context must be a bitfield of ContextType.Guild and ContextType.DM", "context");
} }


public override Task<PreconditionResult> CheckPermissions(IMessage context, Command executingCommand, object moduleInstance) public override Task<PreconditionResult> CheckPermissions(IMessage context, Command executingCommand, object moduleInstance)
{ {
var validContext = false; var validContext = false;


if (Context == ContextType.Invalid)
throw new InvalidOperationException("Invalid ContextType");

if (Context.HasFlag(ContextType.Guild)) if (Context.HasFlag(ContextType.Guild))
validContext = validContext || context.Channel is IGuildChannel; validContext = validContext || context.Channel is IGuildChannel;




Loading…
Cancel
Save