move admin check to ContextChecksExt, allow pk;debug proxy for staff in support server
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
using System.Linq;
|
||||
|
||||
using Autofac;
|
||||
|
||||
using Myriad.Types;
|
||||
|
||||
using PluralKit.Core;
|
||||
@@ -52,5 +56,19 @@ namespace PluralKit.Bot
|
||||
throw new PKError($"You must have the \"{permissionName}\" permission in this server to use this command.");
|
||||
return ctx;
|
||||
}
|
||||
|
||||
public static bool CheckBotAdmin(this Context ctx)
|
||||
{
|
||||
var botConfig = ctx.Services.Resolve<BotConfig>();
|
||||
return botConfig.AdminRole != null && ctx.Member != null && ctx.Member.Roles.Contains(botConfig.AdminRole.Value);
|
||||
}
|
||||
|
||||
public static Context AssertBotAdmin(this Context ctx)
|
||||
{
|
||||
if (!ctx.CheckBotAdmin())
|
||||
throw new PKError("This command is only usable by bot admins.");
|
||||
|
||||
return ctx;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user