Bat/src/main/java/cc/fascinated/bat/command/impl/BotStatsCommand.java

36 lines
1.3 KiB
Java
Raw Normal View History

2024-06-27 11:28:38 +01:00
package cc.fascinated.bat.command.impl;
import cc.fascinated.bat.command.BatCommand;
import cc.fascinated.bat.common.EmbedUtils;
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.JDA;
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
public class BotStatsCommand extends BatCommand {
public BotStatsCommand() {
super("botstats", "Shows the bot statistics");
}
@Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) {
JDA jda = DiscordService.JDA;
2024-06-27 11:45:06 +01:00
interaction.replyEmbeds(EmbedUtils.genericEmbed().setDescription(
"**Bot Statistics**\n" +
"➜ Guilds: %s\n".formatted(jda.getGuilds().size()) +
"➜ Users: %s\n".formatted(jda.getUsers().size()) +
"➜ Gateway Ping: %sms".formatted(jda.getGatewayPing())
).build()).queue();
2024-06-27 11:28:38 +01:00
}
}