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
+11 -14

No files matched your search

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