fix PermissionPrecondition

This commit is contained in:
anthorob committed 2026-10-04 15:05:11 -04:00
1 parent 88389f3db0
commit 5b1df7038c
3 files changed
+16 -19

No files matched your search

@@ -30,11 +30,6 @@ public class SlashCommandContext extends CommandContext implements InteractionCo
return true; return true;
} }
@Override
public boolean canSkipPermissionCheck() {
return true;
}
@Override @Override
public SlashCommandInteractionEvent getEvent() { public SlashCommandInteractionEvent getEvent() {
return event; return event;
@@ -21,19 +21,21 @@ public class PermissionPrecondition implements CommandPrecondition {
return true; return true;
} }
if (command.canBeExecutedFrom(context.getChannel())) { if (!command.canBeExecutedFrom(context.getChannel())) {
return true; context.replyEphemeral("This command cannot be executed in the current channel");
}
if (command.canBeExecutedBy(context.getGuildUser())) {
return true;
}
if (command.needAdmin() && UserFunction.isAdmin(context.getGuildUser())) {
return true;
}
context.reply("You are not powerful enough, scrub");
return false; return false;
} }
if (command.needAdmin() && !UserFunction.isAdmin(context.getGuildUser())) {
context.replyEphemeral("You are not powerful enough, scrub");
return false;
}
if (!command.canBeExecutedBy(context.getGuildUser())) {
context.replyEphemeral("You are not powerful enough, scrub");
return false;
}
return true;
}
} }
@@ -62,7 +62,7 @@ public class GuildService {
* @return the persistent guild * @return the persistent guild
*/ */
public OGuild findOrCreateGuild(String guildId) { public OGuild findOrCreateGuild(String guildId) {
logger.debug("Loading Guild[{}]", guildId); logger.debug("Loading Guild: {}", guildId);
return guildRepository.findOrCreate(guildId); return guildRepository.findOrCreate(guildId);
} }