Don't deferReply()

java-rewrite
Hammy 3 years ago
parent 3c6fa3e5e3
commit cfb30771f4

@ -6,7 +6,6 @@ import me.goudham.command.annotation.SlashCommand;
import me.goudham.service.EmbedService; import me.goudham.service.EmbedService;
import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.events.interaction.SlashCommandEvent; import net.dv8tion.jda.api.events.interaction.SlashCommandEvent;
import net.dv8tion.jda.api.interactions.InteractionHook;
@SlashCommand(name = "ping", description = "Display the latency of the bot", isVisible = true) @SlashCommand(name = "ping", description = "Display the latency of the bot", isVisible = true)
public class Ping { public class Ping {
@ -18,11 +17,8 @@ public class Ping {
} }
@Executable @Executable
public void handle(SlashCommandEvent event) { public void handle(SlashCommandEvent slashCommandEvent) {
event.deferReply(false).queue(); JDA jda = slashCommandEvent.getJDA();
InteractionHook hook = event.getHook(); jda.getRestPing().queue(ping -> slashCommandEvent.replyEmbeds(embedService.getBaseEmbed().setDescription("**Rest ping: " + ping + "ms**\n**WS ping: " + jda.getGatewayPing() + "ms**").build()).queue());
JDA jda = event.getJDA();
jda.getRestPing().queue(ping -> hook.sendMessageEmbeds(embedService.getBaseEmbed().setDescription("**Rest ping: " + ping + "ms**\n**WS ping: " + jda.getGatewayPing() + "ms**").build()).queue());
} }
} }
Loading…
Cancel
Save