|
|
|
@ -5,6 +5,7 @@ import jakarta.inject.Inject;
|
|
|
|
|
import me.goudham.command.annotation.SlashCommand;
|
|
|
|
|
import me.goudham.service.EmbedService;
|
|
|
|
|
import net.dv8tion.jda.api.JDA;
|
|
|
|
|
import net.dv8tion.jda.api.entities.MessageEmbed;
|
|
|
|
|
import net.dv8tion.jda.api.events.interaction.SlashCommandEvent;
|
|
|
|
|
|
|
|
|
|
@SlashCommand(name = "ping", description = "Display the latency of the bot")
|
|
|
|
@ -19,6 +20,11 @@ public class Ping {
|
|
|
|
|
@Executable
|
|
|
|
|
public void handle(SlashCommandEvent slashCommandEvent) {
|
|
|
|
|
JDA jda = slashCommandEvent.getJDA();
|
|
|
|
|
jda.getRestPing().queue(ping -> slashCommandEvent.replyEmbeds(embedService.getBaseEmbed().setDescription("**Rest ping: " + ping + "ms**\n**WS ping: " + jda.getGatewayPing() + "ms**").build()).queue());
|
|
|
|
|
jda.getRestPing().queue(ping -> {
|
|
|
|
|
MessageEmbed messageEmbed = embedService.getBaseEmbed()
|
|
|
|
|
.setDescription("**Rest ping: " + ping + "ms**\n**WS ping: " + jda.getGatewayPing() + "ms**")
|
|
|
|
|
.build();
|
|
|
|
|
slashCommandEvent.replyEmbeds(messageEmbed).queue();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|