update member count command to look similar to botstats command
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 36s

This commit is contained in:
Lee 2024-07-01 15:23:19 +01:00
parent 52349a17c3
commit 8361f3c784

@ -27,7 +27,6 @@ import java.util.Map;
public class MemberCountCommand extends BatCommand { public class MemberCountCommand extends BatCommand {
@Override @Override
public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) { public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction interaction) {
EmbedBuilder embed = EmbedUtils.genericEmbed().setAuthor("Member Count");
Guild discordGuild = guild.getDiscordGuild(); Guild discordGuild = guild.getDiscordGuild();
int totalMembers = 0, totalUsers = 0, totalBots = 0; int totalMembers = 0, totalUsers = 0, totalBots = 0;
Map<OnlineStatus, Integer> memberCounts = new HashMap<>(); Map<OnlineStatus, Integer> memberCounts = new HashMap<>();
@ -42,12 +41,14 @@ public class MemberCountCommand extends BatCommand {
} }
totalMembers++; totalMembers++;
} }
interaction.replyEmbeds(EmbedUtils.genericEmbed()
embed.setDescription(""" .setDescription("""
**Member Count**
Total Members: `%s` Total Members: `%s`
Total Users: `%s` Total Users: `%s`
Total Bots: `%s` Total Bots: `%s`
\s \s
**Member Presence**
%s Online: `%s` %s Online: `%s`
%s Idle: `%s` %s Idle: `%s`
%s Do Not Disturb: `%s` %s Do Not Disturb: `%s`
@ -62,7 +63,7 @@ public class MemberCountCommand extends BatCommand {
Emojis.DND_EMOJI, Emojis.DND_EMOJI,
NumberFormatter.format(memberCounts.getOrDefault(OnlineStatus.DO_NOT_DISTURB, 0)), NumberFormatter.format(memberCounts.getOrDefault(OnlineStatus.DO_NOT_DISTURB, 0)),
Emojis.OFFLINE_EMOJI, Emojis.OFFLINE_EMOJI,
NumberFormatter.format(memberCounts.getOrDefault(OnlineStatus.OFFLINE, 0)))); NumberFormatter.format(memberCounts.getOrDefault(OnlineStatus.OFFLINE, 0))))
interaction.replyEmbeds(embed.build()).queue(); .build()).queue();
} }
} }