Files
archived-discord-bot/CompatBot/Commands/Attributes/RequiresSupporterRole.cs
2023-04-21 02:05:59 +05:00

15 lines
588 B
C#

using System;
using System.Threading.Tasks;
using CompatBot.Utils;
using DSharpPlus.CommandsNext;
namespace CompatBot.Commands.Attributes;
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
internal class RequiresSupporterRole: CheckBaseAttributeWithReactions
{
public RequiresSupporterRole() : base(reactOnFailure: Config.Reactions.Denied) { }
protected override Task<bool> IsAllowed(CommandContext ctx, bool help)
=> Task.FromResult(ctx.User.IsWhitelisted(ctx.Client, ctx.Guild) || ctx.User.IsSupporter(ctx.Client, ctx.Guild));
}