Liam
fa10cf2019
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 1m10s
31 lines
1.2 KiB
Java
31 lines
1.2 KiB
Java
package cc.fascinated.bat.command.impl;
|
|
|
|
import cc.fascinated.bat.command.BatCommand;
|
|
import cc.fascinated.bat.command.CommandInfo;
|
|
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;
|
|
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
|
import net.dv8tion.jda.api.interactions.commands.SlashCommandInteraction;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
/**
|
|
* @author Fascinated (fascinated7)
|
|
*/
|
|
@Component
|
|
@CommandInfo(name = "ping", description = "Gets the ping of the bot", guildOnly = false)
|
|
public class PingCommand extends BatCommand {
|
|
@Override
|
|
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) {
|
|
long time = System.currentTimeMillis();
|
|
interaction.reply("Pinging...").queue(response -> {
|
|
response.editOriginal("Gateway response time: `%sms`\nAPI response time `%sms`".formatted(
|
|
DiscordService.JDA.getGatewayPing(),
|
|
System.currentTimeMillis() - time
|
|
)).queue();
|
|
});
|
|
}
|
|
}
|