Custom error messages

This commit is contained in:
GregTCLTK 2020-01-03 15:25:45 +01:00
parent 8cb9613fd6
commit 912dba9158
No known key found for this signature in database
GPG key ID: A91BADE5C070FF67
2 changed files with 8 additions and 8 deletions

View file

@ -1,15 +1,14 @@
package com.bbn.hadder.commands.music;
/*
* @author Skidder / GregTCLTK
*/
import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.MessageEditor;
import net.dv8tion.jda.api.entities.VoiceChannel;
import net.dv8tion.jda.api.managers.AudioManager;
/*
* @author Skidder / GregTCLTK
*/
public class JoinCommand implements Command {

View file

@ -41,8 +41,9 @@ public class CommandHandler {
for (Perm perm : cmd.getClass().getAnnotation(Perms.class).value()) {
if (!perm.check(commandEvent)) {
commandEvent.getTextChannel()
.sendMessage(commandEvent.getMessageEditor().getMessage(MessageEditor.MessageType.NO_PERMISSION).build())
.queue();
.sendMessage(commandEvent.getMessageEditor().getMessage(MessageEditor.MessageType.NO_PERMISSION)
.setDescription("To execute this command, you need the `" + cmd.getClass().getAnnotation(Perms.class).value()[0] + "` permission.")
.build()).queue();
return;
}
}
@ -51,8 +52,8 @@ public class CommandHandler {
boolean run = true;
String blacklisted = rethink.getBlackListed(event.getAuthor().getId());
if (!"none".equals(blacklisted)) {
for (String blacklistedlabel : blacklisted.split(",")) {
if (Arrays.asList(cmd.labels()).contains(blacklistedlabel)) {
for (String BLLabel : blacklisted.split(",")) {
if (Arrays.asList(cmd.labels()).contains(BLLabel)) {
run = false;
}
}