Browse Source

Allow preconditions to be used multiple times (for use with groups)

pull/928/head
Christopher F 7 years ago
parent
commit
bc7801376d
3 changed files with 6 additions and 7 deletions
  1. +2
    -2
      src/Discord.Net.Commands/Attributes/Preconditions/RequireContextAttribute.cs
  2. +2
    -2
      src/Discord.Net.Commands/Attributes/Preconditions/RequireNsfwAttribute.cs
  3. +2
    -3
      src/Discord.Net.Commands/Attributes/Preconditions/RequireOwnerAttribute.cs

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

@@ -1,4 +1,4 @@
using System;
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;

@@ -15,7 +15,7 @@ namespace Discord.Commands
/// <summary>
/// Require that the command be invoked in a specified context.
/// </summary>
[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; }


+ 2
- 2
src/Discord.Net.Commands/Attributes/Preconditions/RequireNsfwAttribute.cs View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Threading.Tasks;

namespace Discord.Commands
@@ -6,7 +6,7 @@ namespace Discord.Commands
/// <summary>
/// Require that the command is invoked in a channel marked NSFW
/// </summary>
[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<PreconditionResult> CheckPermissionsAsync(ICommandContext context, CommandInfo command, IServiceProvider services)


+ 2
- 3
src/Discord.Net.Commands/Attributes/Preconditions/RequireOwnerAttribute.cs View File

@@ -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.
/// </summary>
/// <remarks>This precondition will only work if the bot is a bot account.</remarks>
[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<PreconditionResult> CheckPermissionsAsync(ICommandContext context, CommandInfo command, IServiceProvider services)


Loading…
Cancel
Save