Skip to content

Commit

Permalink
Ignore view channels/embed links permissions for slash commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Chew committed Oct 18, 2021
1 parent 2435212 commit 6190a3d
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@ public final void run(SlashCommandEvent event, CommandClient client)
//user perms
for(Permission p: userPermissions)
{
// Member will never be null because this is only ran in a server (text channel)
if(event.getMember() == null)
continue;

if(p.isChannel())
{
if(!event.getMember().hasPermission(event.getTextChannel(), p))
Expand All @@ -272,6 +276,12 @@ public final void run(SlashCommandEvent event, CommandClient client)
// bot perms
for(Permission p: botPermissions)
{
// We can ignore this permission because bots can reply with embeds even without either of these perms.
// The only thing stopping them is the user's ability to use Application Commands.
// It's extremely dumb, but what more can you do.
if (p == Permission.VIEW_CHANNEL || p == Permission.MESSAGE_EMBED_LINKS)
continue;

Member selfMember = event.getGuild() == null ? null : event.getGuild().getSelfMember();
if(p.isChannel())
{
Expand Down

0 comments on commit 6190a3d

Please sign in to comment.