Skip to content

Commit baf81d9

Browse files
Add OwnerOverride to SlashRequireHomeserverPerm & /send-insiders-info-buttons
1 parent c5f6411 commit baf81d9

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

CommandChecks/HomeServerPerms.cs

+10-2
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,22 @@ public override async Task<bool> ExecuteCheckAsync(CommandContext ctx, bool help
137137
public class SlashRequireHomeserverPermAttribute : SlashCheckBaseAttribute
138138
{
139139
public ServerPermLevel TargetLvl;
140+
public bool OwnerOverride;
140141

141-
public SlashRequireHomeserverPermAttribute(ServerPermLevel targetlvl)
142-
=> TargetLvl = targetlvl;
142+
public SlashRequireHomeserverPermAttribute(ServerPermLevel targetlvl, bool ownerOverride = false)
143+
{
144+
TargetLvl = targetlvl;
145+
OwnerOverride = ownerOverride;
146+
}
143147

144148
public override async Task<bool> ExecuteChecksAsync(InteractionContext ctx)
145149
{
146150
if (ctx.Guild.Id != Program.cfgjson.ServerID)
147151
return false;
152+
153+
// bot owners can bypass perm checks ONLY if the command allows it.
154+
if (OwnerOverride && Program.cfgjson.BotOwners.Contains(ctx.User.Id))
155+
return true;
148156

149157
var level = await GetPermLevelAsync(ctx.Member);
150158
if (level >= TargetLvl)

Commands/InteractionCommands/InsidersInteractions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ namespace Cliptok.Commands.InteractionCommands
33
public class InsidersInteractions : ApplicationCommandModule
44
{
55
[SlashCommand("send-insiders-info-buttons", "Sends a message with buttons to get Insider roles for #insiders-info.", false)]
6-
[SlashRequireHomeserverPerm(ServerPermLevel.TrialModerator), SlashCommandPermissions(permissions: DiscordPermission.ModerateMembers)]
6+
[SlashRequireHomeserverPerm(ServerPermLevel.Admin, ownerOverride: true), SlashCommandPermissions(permissions: DiscordPermission.ModerateMembers)]
77
public static async Task SendInsidersInfoButtonMessage(InteractionContext ctx)
88
{
99
if (Program.cfgjson.InsiderInfoChannel != 0 && ctx.Channel.Id != Program.cfgjson.InsiderInfoChannel)

0 commit comments

Comments
 (0)