Catch no permission exception

This commit is contained in:
Greg 2021-04-11 02:08:58 +02:00
parent 4d06604292
commit 0427689f5d
No known key found for this signature in database
GPG key ID: E0CCA757E2B9BA17

View file

@ -78,13 +78,16 @@ public class CommandListener extends ListenerAdapter {
} }
} }
} else { } else {
e.getAuthor().openPrivateChannel().complete().sendMessage(new EmbedBuilder() try {
.setTitle("No permission") e.getAuthor().openPrivateChannel().complete().sendMessage(new EmbedBuilder()
.setDescription("I need the `MESSAGE WRITE` permission in order to work!") .setTitle("No permission")
.setColor(Color.RED) .setDescription("I need the `MESSAGE WRITE` permission in order to work!")
.setFooter("Hadder", "https://bbn.one/images/Hadder.png") .setColor(Color.RED)
.setTimestamp(Instant.now()) .setFooter("Hadder", "https://bbn.one/images/Hadder.png")
.build()).queue(); .setTimestamp(Instant.now())
.build()).queue();
} catch (ErrorResponseException ignore) {}
} }
} }
} }