No permission improvement

This commit is contained in:
GregTCLTK 2020-03-10 17:19:00 +01:00
parent 304c588dbb
commit e811da3aeb
No known key found for this signature in database
GPG key ID: A91BADE5C070FF67

View file

@ -25,6 +25,7 @@ import net.dv8tion.jda.api.EmbedBuilder;
import net.dv8tion.jda.api.Permission;
import net.dv8tion.jda.api.entities.ChannelType;
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
import net.dv8tion.jda.api.exceptions.ErrorResponseException;
import net.dv8tion.jda.api.hooks.ListenerAdapter;
import java.awt.*;
@ -64,6 +65,7 @@ public class CommandListener extends ListenerAdapter {
}
}
} else {
try {
e.getAuthor().openPrivateChannel().complete().sendMessage(new EmbedBuilder()
.setTitle("No permission")
.setDescription("I need the `MESSAGE EMBED LINKS` permission in order to work!")
@ -71,6 +73,9 @@ public class CommandListener extends ListenerAdapter {
.setFooter("Hadder", "https://bigbotnetwork.com/images/Hadder.png")
.setTimestamp(Instant.now())
.build()).queue();
} catch (ErrorResponseException ex) {
e.getTextChannel().sendMessage("I need the `MESSAGE EMBED LINKS` permission in order to work!").queue();
}
}
} else {
e.getAuthor().openPrivateChannel().complete().sendMessage(new EmbedBuilder()