Test fix for delayed interaction replys

This commit is contained in:
Lixfel
2024-12-06 11:23:54 +01:00
parent f01f869479
commit f5f8b3bd06
@@ -20,7 +20,6 @@
package de.steamwar.velocitycore.discord.channels; package de.steamwar.velocitycore.discord.channels;
import net.dv8tion.jda.api.interactions.callbacks.IReplyCallback; import net.dv8tion.jda.api.interactions.callbacks.IReplyCallback;
import net.dv8tion.jda.api.interactions.components.ComponentInteraction;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
@@ -44,6 +43,7 @@ public class InteractionReply extends DiscordChannel {
private InteractionReply(IReplyCallback interaction) { private InteractionReply(IReplyCallback interaction) {
super(interaction.getUser()); super(interaction.getUser());
this.interaction = interaction; this.interaction = interaction;
interaction.deferReply(true).queue();
} }
@Override @Override
@@ -57,10 +57,9 @@ public class InteractionReply extends DiscordChannel {
} }
public void submit() { public void submit() {
(messages.isEmpty() ? if(!messages.isEmpty())
interaction.deferReply() : interaction.reply(String.join("\n", messages)).setEphemeral(true).queue();
interaction.reply(String.join("\n", messages))
).setEphemeral(true).queue();
replied = true; replied = true;
} }
} }