2024-06-25 12:32:06 +01:00
|
|
|
package cc.fascinated.bat.command.impl;
|
|
|
|
|
|
|
|
import cc.fascinated.bat.command.BatCommand;
|
2024-06-27 19:36:52 +01:00
|
|
|
import cc.fascinated.bat.command.CommandInfo;
|
2024-06-25 12:32:06 +01:00
|
|
|
import cc.fascinated.bat.model.BatGuild;
|
|
|
|
import cc.fascinated.bat.model.BatUser;
|
|
|
|
import cc.fascinated.bat.service.DiscordService;
|
|
|
|
import lombok.NonNull;
|
|
|
|
import net.dv8tion.jda.api.entities.Member;
|
2024-06-26 00:41:47 +01:00
|
|
|
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
2024-06-25 12:32:06 +01:00
|
|
|
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Fascinated (fascinated7)
|
|
|
|
*/
|
|
|
|
@Component
|
2024-06-27 21:05:54 +01:00
|
|
|
@CommandInfo(name = "ping", description = "Gets the ping of the bot", guildOnly = false)
|
2024-06-25 12:32:06 +01:00
|
|
|
public class PingCommand extends BatCommand {
|
|
|
|
@Override
|
2024-06-26 00:41:47 +01:00
|
|
|
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) {
|
2024-06-25 12:32:06 +01:00
|
|
|
long time = System.currentTimeMillis();
|
|
|
|
interaction.reply("Pinging...").queue(response -> {
|
2024-06-25 12:36:40 +01:00
|
|
|
response.editOriginal("Gateway response time: `%sms`\nAPI response time `%sms`".formatted(
|
2024-06-25 12:32:06 +01:00
|
|
|
DiscordService.JDA.getGatewayPing(),
|
|
|
|
System.currentTimeMillis() - time
|
|
|
|
)).queue();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|