From bc7801376d6448c81357556ec8717ca91160b636 Mon Sep 17 00:00:00 2001 From: Christopher F Date: Mon, 8 Jan 2018 03:04:59 -0500 Subject: [PATCH] Allow preconditions to be used multiple times (for use with groups) --- .../Attributes/Preconditions/RequireContextAttribute.cs | 4 ++-- .../Attributes/Preconditions/RequireNsfwAttribute.cs | 4 ++-- .../Attributes/Preconditions/RequireOwnerAttribute.cs | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Discord.Net.Commands/Attributes/Preconditions/RequireContextAttribute.cs b/src/Discord.Net.Commands/Attributes/Preconditions/RequireContextAttribute.cs index 5fa0fb1b9..90af035e4 100644 --- a/src/Discord.Net.Commands/Attributes/Preconditions/RequireContextAttribute.cs +++ b/src/Discord.Net.Commands/Attributes/Preconditions/RequireContextAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; @@ -15,7 +15,7 @@ namespace Discord.Commands /// /// Require that the command be invoked in a specified context. /// - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)] public class RequireContextAttribute : PreconditionAttribute { public ContextType Contexts { get; } diff --git a/src/Discord.Net.Commands/Attributes/Preconditions/RequireNsfwAttribute.cs b/src/Discord.Net.Commands/Attributes/Preconditions/RequireNsfwAttribute.cs index c8e3bfa82..273c764bd 100644 --- a/src/Discord.Net.Commands/Attributes/Preconditions/RequireNsfwAttribute.cs +++ b/src/Discord.Net.Commands/Attributes/Preconditions/RequireNsfwAttribute.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Threading.Tasks; namespace Discord.Commands @@ -6,7 +6,7 @@ namespace Discord.Commands /// /// Require that the command is invoked in a channel marked NSFW /// - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)] public class RequireNsfwAttribute : PreconditionAttribute { public override Task CheckPermissionsAsync(ICommandContext context, CommandInfo command, IServiceProvider services) diff --git a/src/Discord.Net.Commands/Attributes/Preconditions/RequireOwnerAttribute.cs b/src/Discord.Net.Commands/Attributes/Preconditions/RequireOwnerAttribute.cs index e370aeec4..7a8a009be 100644 --- a/src/Discord.Net.Commands/Attributes/Preconditions/RequireOwnerAttribute.cs +++ b/src/Discord.Net.Commands/Attributes/Preconditions/RequireOwnerAttribute.cs @@ -1,7 +1,6 @@ -#pragma warning disable CS0618 +#pragma warning disable CS0618 using System; using System.Threading.Tasks; -using Microsoft.Extensions.DependencyInjection; namespace Discord.Commands { @@ -9,7 +8,7 @@ namespace Discord.Commands /// Require that the command is invoked by the owner of the bot. /// /// This precondition will only work if the bot is a bot account. - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)] public class RequireOwnerAttribute : PreconditionAttribute { public override async Task CheckPermissionsAsync(ICommandContext context, CommandInfo command, IServiceProvider services)