Skip to content

Commit

Permalink
address review, these names are better
Browse files Browse the repository at this point in the history
  • Loading branch information
Chew committed Jan 8, 2025
1 parent 5712515 commit 62cd50f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ public Map<DiscordLocale, String> getNameLocalization() {
}

/**
* {@code true} if the command should always respect user permissions, even if the server overrides them,
* {@code false} if the command should ignore user permissions if the server overrides them.
* {@code true} if the command should always respect {@link #userPermissions}, even if the server overrides them,
* {@code false} if the command should ignore {@link #userPermissions} if the server overrides them.
* <br>
* This defaults to false because it interferes with the server's options for interactions.
* <br>
* This has no effect for text based commands or DMs.
*/
protected boolean alwaysRespectUserPermissions = false;
protected boolean forceUserPermissions = false;

/**
* Gets the type of context menu.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ public final void run(MessageContextMenuEvent event)
if(event.isFromGuild())
{
//user perms
if (alwaysRespectUserPermissions)
if (forceUserPermissions)
{
for(Permission p: userPermissions)
{
// Member will never be null because this is only ran in a server (text channel)
Expand All @@ -82,6 +83,7 @@ public final void run(MessageContextMenuEvent event)
}
}
}
}

// bot perms
for(Permission p: botPermissions)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,14 @@ public abstract class SlashCommand extends Command
protected String requiredRole = null;

/**
* {@code true} if the command should always respect user permissions, even if the server overrides them,
* {@code false} if the command should ignore user permissions if the server overrides them.
* {@code true} if the command should always respect {@link #userPermissions}, even if the server overrides them,
* {@code false} if the command should ignore {@link #userPermissions} if the server overrides them.
* <br>
* This defaults to false because it interferes with the server's options for interactions.
* <br>
* This has no effect for text based commands or DMs.
*/
protected boolean alwaysRespectUserPermissions = false;
protected boolean forceUserPermissions = false;

/**
* The child commands of the command. These are used in the format {@code /<parent name>
Expand Down Expand Up @@ -231,7 +231,8 @@ public final void run(SlashCommandEvent event)
if(event.getChannelType() != ChannelType.PRIVATE)
{
//user perms
if (alwaysRespectUserPermissions)
if (forceUserPermissions)
{
for(Permission p: userPermissions)
{
// Member will never be null because this is only ran in a server (text channel)
Expand All @@ -255,6 +256,7 @@ public final void run(SlashCommandEvent event)
}
}
}
}

// bot perms
for(Permission p: botPermissions)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ public final void run(UserContextMenuEvent event)
if(event.isFromGuild())
{
//user perms
if (alwaysRespectUserPermissions)
if (forceUserPermissions)
{
for(Permission p: userPermissions)
{
// Member will never be null because this is only ran in a server
Expand All @@ -119,6 +120,7 @@ public final void run(UserContextMenuEvent event)
}
}
}
}

// bot perms
for(Permission p: botPermissions)
Expand Down

0 comments on commit 62cd50f

Please sign in to comment.