From 2fcc1b66c11bcce99c3ac59ff05e746fb42b8579 Mon Sep 17 00:00:00 2001 From: Liam Date: Thu, 4 Jul 2024 02:58:29 +0100 Subject: [PATCH] update original message --- pom.xml | 5 ----- .../bat/features/drag/command/RequestSubCommand.java | 8 +++----- .../features/drag/listeners/request/RequestListener.java | 2 +- .../drag/listeners/request/TargetChannelListener.java | 6 ++++++ 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index 7ee2901..184c9ef 100644 --- a/pom.xml +++ b/pom.xml @@ -159,11 +159,6 @@ spotify-web-api-java 8.4.0 - - com.github.ben-manes.caffeine - caffeine - 3.1.8 - uk.co.conoregan themoviedbapi diff --git a/src/main/java/cc/fascinated/bat/features/drag/command/RequestSubCommand.java b/src/main/java/cc/fascinated/bat/features/drag/command/RequestSubCommand.java index 4c35631..13ecee6 100644 --- a/src/main/java/cc/fascinated/bat/features/drag/command/RequestSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/drag/command/RequestSubCommand.java @@ -137,11 +137,9 @@ public class RequestSubCommand extends BatSubCommand implements EventListener { Button.primary("drag-request-accept", "Accept"), Button.danger("drag-request-decline", "Decline") )) - .queue(message -> { - JOIN_REQUESTS.stream() - .filter(r -> r.getVoiceChannel().getId().equals(targetChannel.getId())) - .findFirst().ifPresent(request -> request.setRequestMessage(message)); - }); + .queue(message -> JOIN_REQUESTS.stream() + .filter(r -> r.getVoiceChannel().getId().equals(targetChannel.getId())) + .findFirst().ifPresent(request -> request.setRequestMessage(message))); event.replyEmbeds(EmbedUtils.successEmbed() .setDescription("Request to join %s's voice channel has been sent.".formatted(target.getAsMention())) .build()) diff --git a/src/main/java/cc/fascinated/bat/features/drag/listeners/request/RequestListener.java b/src/main/java/cc/fascinated/bat/features/drag/listeners/request/RequestListener.java index f447e7c..aef6747 100644 --- a/src/main/java/cc/fascinated/bat/features/drag/listeners/request/RequestListener.java +++ b/src/main/java/cc/fascinated/bat/features/drag/listeners/request/RequestListener.java @@ -28,7 +28,7 @@ public class RequestListener implements EventListener { .findFirst(); if (optionalDragRequest.isEmpty()) { event.replyEmbeds(EmbedUtils.errorEmbed() - .setDescription("You do not have a request to cancel.") + .setDescription("%s, you do not have a request to cancel.".formatted(user.getDiscordUser().getAsMention())) .build()).queue(); return; } diff --git a/src/main/java/cc/fascinated/bat/features/drag/listeners/request/TargetChannelListener.java b/src/main/java/cc/fascinated/bat/features/drag/listeners/request/TargetChannelListener.java index 27d38be..87b0d8f 100644 --- a/src/main/java/cc/fascinated/bat/features/drag/listeners/request/TargetChannelListener.java +++ b/src/main/java/cc/fascinated/bat/features/drag/listeners/request/TargetChannelListener.java @@ -31,6 +31,12 @@ public class TargetChannelListener implements EventListener { if (event.getComponentId().equals("drag-request-accept")) { joinRequest.getVoiceChannel().getGuild().moveVoiceMember(joinRequest.getMember(), joinRequest.getVoiceChannel()).queue(); + joinRequest.getInteractionHook().retrieveOriginal().queue(message -> { + message.editMessageEmbeds(EmbedUtils.successEmbed() + .setDescription("%s has accepted your request to join their voice channel!".formatted(joinRequest.getTarget().getAsMention())) + .build()).queue(then -> then.delete().queueAfter(10, java.util.concurrent.TimeUnit.SECONDS)); + message.editMessageComponents().queue(); + }); event.replyEmbeds(EmbedUtils.successEmbed() .setDescription("You have accepted %s's request to join your voice channel!".formatted(joinRequest.getMember().getAsMention())) .build())