From 6190a3d8f5dd76848042199710dd5ce502b36907 Mon Sep 17 00:00:00 2001 From: Chew Date: Mon, 18 Oct 2021 14:46:02 -0500 Subject: [PATCH] Ignore view channels/embed links permissions for slash commands --- .../com/jagrosh/jdautilities/command/SlashCommand.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/command/src/main/java/com/jagrosh/jdautilities/command/SlashCommand.java b/command/src/main/java/com/jagrosh/jdautilities/command/SlashCommand.java index e0e4a56e..74b96280 100644 --- a/command/src/main/java/com/jagrosh/jdautilities/command/SlashCommand.java +++ b/command/src/main/java/com/jagrosh/jdautilities/command/SlashCommand.java @@ -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)) @@ -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()) {