Skip to content

Commit

Permalink
Fix up a stupid way of handling ephermal support.
Browse files Browse the repository at this point in the history
Signed-off-by: Presti <dxssucuk@hotmail.com>
  • Loading branch information
DxsSucuk committed Oct 22, 2024
1 parent ce72e8b commit 5ee4083
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/main/java/de/presti/ree6/commands/CommandEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,15 @@ public class CommandEvent {
* @param arguments the given Arguments.
* @param slashCommandInteractionEvent the {@link SlashCommandInteractionEvent} Entity.
*/
public CommandEvent(String command, @Nonnull Member member, @Nonnull Guild guild, @Nullable Message message, @Nonnull GuildMessageChannelUnion textChannel, @Nullable String[] arguments, @Nullable SlashCommandInteractionEvent slashCommandInteractionEvent) {
public CommandEvent(String command, @Nonnull Member member, @Nonnull Guild guild, @Nullable Message message, @Nonnull GuildMessageChannelUnion textChannel, @Nullable String[] arguments, @Nullable SlashCommandInteractionEvent slashCommandInteractionEvent, boolean isEphermal) {
this.command = command;
this.member = member;
this.guild = guild;
this.message = message;
this.channel = textChannel;
this.arguments = arguments;
this.slashCommandInteractionEvent = slashCommandInteractionEvent;
setEphemeral(isEphermal);
}

/**
Expand Down Expand Up @@ -357,7 +358,7 @@ public boolean isSlashCommand() {
* @return the {@link InteractionHook} Entity.
*/
public InteractionHook getInteractionHook() {
if (isSlashCommand()) return getSlashCommandInteractionEvent().getHook().setEphemeral(true);
if (isSlashCommand()) return getSlashCommandInteractionEvent().getHook();

return null;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/de/presti/ree6/commands/CommandManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ private Mono<Boolean> performMessageCommand(Member member, Guild guild, String m
String[] argumentsParsed = Arrays.copyOfRange(arguments, 1, arguments.length);

// Perform the Command.
return command.onMonoPerform(new CommandEvent(commandAnnotation.name(), member, guild, message, textChannel, argumentsParsed, null)).block();
return command.onMonoPerform(new CommandEvent(commandAnnotation.name(), member, guild, message, textChannel, argumentsParsed, null, true)).block();
});
}

Expand All @@ -615,7 +615,7 @@ private Mono<Boolean> performSlashCommand(GuildMessageChannelUnion messageChanne

if (!annotation.allowAppInstall() && guild.isDetached()) return Mono.just(false);

CommandEvent commandEvent = new CommandEvent(annotation.name(), slashCommandInteractionEvent.getMember(), guild, null, messageChannel, null, slashCommandInteractionEvent);
CommandEvent commandEvent = new CommandEvent(annotation.name(), slashCommandInteractionEvent.getMember(), guild, null, messageChannel, null, slashCommandInteractionEvent, true);

if (guild.isDetached()) {
return command.onMonoPerform(commandEvent);
Expand Down

0 comments on commit 5ee4083

Please sign in to comment.