Skip to content

Commit

Permalink
🐛 Fixed 'enabled for' entry for slash commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Sky committed Feb 2, 2025
1 parent 8f583b3 commit 3215c95
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.itsthesky.disky.elements.structures.slash.models;

import net.dv8tion.jda.api.interactions.commands.DefaultMemberPermissions;
import net.itsthesky.disky.DiSky;
import net.dv8tion.jda.api.interactions.DiscordLocale;
import net.dv8tion.jda.api.interactions.commands.OptionType;
Expand Down Expand Up @@ -116,7 +117,13 @@ public SlashCommandData buildCommandData() {
for (ParsedArgument arg : singleCommand.getArguments()) {
commandData.addOptions(createOptionData(arg));
}

if (singleCommand.isDisabledByDefault() && singleCommand.getEnabledFor().isEmpty())
commandData.setDefaultPermissions(DefaultMemberPermissions.DISABLED);
else if (!singleCommand.getEnabledFor().isEmpty())
commandData.setDefaultPermissions(DefaultMemberPermissions.enabledFor(singleCommand.getEnabledFor()));
}

return commandData;
}

Expand Down

0 comments on commit 3215c95

Please sign in to comment.