Merge branch 'master' into master
This commit is contained in:
@ -26,9 +26,9 @@ import java.lang.management.RuntimeMXBean;
|
||||
@Component
|
||||
@CommandInfo(name = "botstats", description = "Shows the bot statistics", guildOnly = false)
|
||||
public class BotStatsCommand extends BatCommand {
|
||||
RuntimeMXBean bean = ManagementFactory.getRuntimeMXBean();
|
||||
private final GuildService guildService;
|
||||
private final UserService userService;
|
||||
private final RuntimeMXBean bean = ManagementFactory.getRuntimeMXBean();
|
||||
|
||||
@Autowired
|
||||
public BotStatsCommand(@NonNull GuildService guildService, @NonNull UserService userService) {
|
||||
@ -42,14 +42,14 @@ public class BotStatsCommand extends BatCommand {
|
||||
|
||||
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\n".formatted(jda.getGatewayPing()) +
|
||||
"\n" +
|
||||
"**Bat Statistics**\n" +
|
||||
"➜ Uptime: %s\n".formatted(TimeUtils.format(bean.getUptime())) +
|
||||
"➜ Cached Guilds: %s\n".formatted(guildService.getGuilds().size()) +
|
||||
"➜ Cached Users: %s".formatted(userService.getUsers().size())
|
||||
"➜ Guilds: **%s\n".formatted(jda.getGuilds().size()) +
|
||||
"➜ Users: **%s\n".formatted(jda.getUsers().size()) +
|
||||
"➜ Gateway Ping: **%sms**\n".formatted(jda.getGatewayPing()) +
|
||||
"\n" +
|
||||
"**Bat Statistics**\n" +
|
||||
"➜ Uptime: **%s**\n".formatted(TimeUtils.format(bean.getUptime())) +
|
||||
"➜ Cached Guilds: **%s**\n".formatted(guildService.getGuilds().size()) +
|
||||
"➜ Cached Users: **%s**".formatted(userService.getUsers().size())
|
||||
).build()).queue();
|
||||
}
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ public class HelpCommand extends BatCommand implements EventListener {
|
||||
SelectOption.of(category.getName(), category.getName()).withEmoji(category.getEmoji()))
|
||||
.toList());
|
||||
|
||||
return new LayoutComponent[] {
|
||||
return new LayoutComponent[]{
|
||||
ActionRow.of(
|
||||
Button.of(ButtonStyle.LINK, Consts.INVITE_URL, "Invite"),
|
||||
Button.of(ButtonStyle.LINK, Consts.SUPPORT_INVITE_URL, "Support")
|
||||
@ -147,4 +147,4 @@ public class HelpCommand extends BatCommand implements EventListener {
|
||||
)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public class PingCommand extends BatCommand {
|
||||
interaction.reply("Pinging...").queue(response -> {
|
||||
response.editOriginal("Gateway response time: `%sms`\nAPI response time `%sms`".formatted(
|
||||
DiscordService.JDA.getGatewayPing(),
|
||||
System.currentTimeMillis() - time
|
||||
System.currentTimeMillis() - time
|
||||
)).queue();
|
||||
});
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public class SetSubCommand extends BatSubCommand {
|
||||
}
|
||||
guildService.saveGuild(batGuild);
|
||||
if (!infinite) {
|
||||
interaction.reply("The guild **%s** has been set as premium until <t:%s>".formatted(guild.getName(), premium.getExpiresAt().toInstant().toEpochMilli()/1000)).queue();
|
||||
interaction.reply("The guild **%s** has been set as premium until <t:%s>".formatted(guild.getName(), premium.getExpiresAt().toInstant().toEpochMilli() / 1000)).queue();
|
||||
} else {
|
||||
interaction.reply("The guild **%s** has been set as premium indefinitely".formatted(guild.getName())).queue();
|
||||
}
|
||||
|
@ -25,9 +25,9 @@ public class PremiumCommand extends BatCommand {
|
||||
EmbedBuilder embed = EmbedUtils.genericEmbed().setAuthor("Premium Information");
|
||||
if (premium.hasPremium()) {
|
||||
embed.addField("Premium", premium.hasPremium() ? "Yes" : "No", true);
|
||||
embed.addField("Started On", "<t:%d>".formatted(premium.getActivatedAt().toInstant().toEpochMilli()/1000), true);
|
||||
embed.addField("Expires At", premium.isInfinite() ? "Never" : "<t:%d>"
|
||||
.formatted(premium.getExpiresAt().toInstant().toEpochMilli()/1000), true);
|
||||
embed.addField("Started", "<t:%d>".formatted(premium.getActivatedAt().toInstant().toEpochMilli() / 1000), true);
|
||||
embed.addField("Expires", premium.isInfinite() ? "Never" : "<t:%d>"
|
||||
.formatted(premium.getExpiresAt().toInstant().toEpochMilli() / 1000), true);
|
||||
} else {
|
||||
embed.setDescription("The guild does not have premium");
|
||||
}
|
||||
|
Reference in New Issue
Block a user