Skip to content

Commit ae124b9

Browse files
authored
Merge pull request #142 from Kamiql/v4
SlashJDAExceptionHandler
2 parents 7fa0da5 + 07fbe09 commit ae124b9

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

jda/src/main/java/revxrsal/commands/jda/exception/SlashJDAExceptionHandler.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,30 +37,30 @@ public class SlashJDAExceptionHandler<A extends SlashCommandActor> extends Defau
3737

3838
@HandleException
3939
public void onMemberNotInGuild(MemberNotInGuildException e, SlashCommandActor actor) {
40-
actor.commandEvent().reply("🛑 User **" + e.suppliedUser().getEffectiveName() + "** is not in this guild.").queue();
40+
actor.commandEvent().getHook().sendMessage("🛑 User **" + e.suppliedUser().getEffectiveName() + "** is not in this guild.").setEphemeral(true).queue();
4141
}
4242

4343
@HandleException
4444
public void onWrongChannelType(WrongChannelTypeException e, SlashCommandActor actor) {
4545
String typeName = e.expectedType().getSimpleName();
4646
String exp = separateCamelCase(typeName, " ").toLowerCase(Locale.ENGLISH);
4747
String rec = e.channel().getType().name().toLowerCase().replace('_', ' ');
48-
actor.commandEvent().reply("🛑 Wrong channel type. Expected a **" + exp + "**, received a **" + rec + "**.").queue();
48+
actor.commandEvent().getHook().sendMessage("🛑 Wrong channel type. Expected a **" + exp + "**, received a **" + rec + "**.").setEphemeral(true).queue();
4949
}
5050

5151
@HandleException
5252
public void onGuildOnlyCommand(GuildOnlyCommandException e, SlashCommandActor actor) {
53-
actor.commandEvent().reply("🛑 This command can only be used in guilds").queue();
53+
actor.commandEvent().getHook().sendMessage("🛑 This command can only be used in guilds").setEphemeral(true).queue();
5454
}
5555

5656
@Override public void onCommandInvocation(@NotNull CommandInvocationException e, @NotNull A actor) {
57-
actor.commandEvent().reply("🛑 An error has occurred while executing this command. Please contact the developers." +
58-
" Errors have been printed to the console.").queue();
57+
actor.commandEvent().getHook().sendMessage("🛑 An error has occurred while executing this command. Please contact the developers." +
58+
" Errors have been printed to the console.").setEphemeral(true).queue();
5959
e.cause().printStackTrace();
6060
}
6161

6262
@Override public void onNoPermission(@NotNull NoPermissionException e, @NotNull A actor) {
63-
actor.replyToInteraction("🛑 You do not have permission to execute this command!").queue();
63+
actor.replyToInteraction("🛑 You do not have permission to execute this command!").setEphemeral(true).queue();
6464
}
6565

6666
@HandleException
@@ -76,9 +76,9 @@ public void onInvalidCategory(InvalidCategoryException e, A actor) {
7676
@Override
7777
public void onInvalidHelpPage(@NotNull InvalidHelpPageException e, @NotNull A actor) {
7878
if (e.numberOfPages() == 1)
79-
actor.replyToInteraction("🛑 Invalid help page: **" + e.page() + "**. Must be 1.").queue();
79+
actor.replyToInteraction("🛑 Invalid help page: **" + e.page() + "**. Must be 1.").setEphemeral(true).queue();
8080
else
81-
actor.replyToInteraction("🛑 Invalid help page: **" + e.page() + "**. Must be between 1 and " + e.numberOfPages()).queue();
81+
actor.replyToInteraction("🛑 Invalid help page: **" + e.page() + "**. Must be between 1 and " + e.numberOfPages()).setEphemeral(true).queue();
8282
}
8383

8484
@HandleException

0 commit comments

Comments
 (0)