Perms Check #63

Merged
greg6775 merged 1 commit from greg-dev into master 2019-11-16 19:58:04 +01:00
Showing only changes of commit d9d6dfe195 - Show all commits

View file

@ -4,6 +4,7 @@ import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent; import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.MessageEditor; import com.bbn.hadder.utils.MessageEditor;
import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.Permission;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -13,6 +14,7 @@ public class HelpCommand implements Command {
@Override @Override
public void executed(String[] args, CommandEvent event) { public void executed(String[] args, CommandEvent event) {
if (event.getGuild().getSelfMember().hasPermission(Permission.MESSAGE_EMBED_LINKS)) {
if (args.length == 0) { if (args.length == 0) {
HashMap<String, ArrayList<Command>> hashMap = new HashMap<>(); HashMap<String, ArrayList<Command>> hashMap = new HashMap<>();
for (Command cmd : event.getCommandHandler().getCommandList()) { for (Command cmd : event.getCommandHandler().getCommandList()) {
@ -55,6 +57,9 @@ public class HelpCommand implements Command {
} }
} }
} }
} else {
event.getTextChannel().sendMessage("I need the Embed Links Permission to send the Help Menu!").queue();
}
} }
@Override @Override