update member count command to look similar to botstats command
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 36s
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 36s
This commit is contained in:
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,27 +41,29 @@ 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`
|
||||||
%s Offline: `%s`""".formatted(
|
%s Offline: `%s`""".formatted(
|
||||||
NumberFormatter.format(totalMembers),
|
NumberFormatter.format(totalMembers),
|
||||||
NumberFormatter.format(totalUsers),
|
NumberFormatter.format(totalUsers),
|
||||||
NumberFormatter.format(totalBots),
|
NumberFormatter.format(totalBots),
|
||||||
Emojis.ONLINE_EMOJI,
|
Emojis.ONLINE_EMOJI,
|
||||||
NumberFormatter.format(memberCounts.getOrDefault(OnlineStatus.ONLINE, 0)),
|
NumberFormatter.format(memberCounts.getOrDefault(OnlineStatus.ONLINE, 0)),
|
||||||
Emojis.IDLE_EMOJI,
|
Emojis.IDLE_EMOJI,
|
||||||
NumberFormatter.format(memberCounts.getOrDefault(OnlineStatus.IDLE, 0)),
|
NumberFormatter.format(memberCounts.getOrDefault(OnlineStatus.IDLE, 0)),
|
||||||
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user