@@ -0,0 +1,2073 @@
+package top.quantic.sentry.health;%0A%0Aimport org.springframework.boot.actuate.health.Health;%0Aimport org.springframework.boot.actuate.health.HealthIndicator;%0Aimport org.springframework.stereotype.Component;%0Aimport sx.blah.discord.api.IDiscordClient;%0Aimport top.quantic.sentry.discord.core.ClientRegistry;%0Aimport top.quantic.sentry.domain.Bot;%0A%0Aimport java.util.LinkedHashMap;%0Aimport java.util.Map;%0A%0A@Component%0Apublic class BotHealthIndicator implements HealthIndicator %7B%0A%0A    private final ClientRegistry clientRegistry;%0A%0A    public BotHealthIndicator(ClientRegistry clientRegistry) %7B%0A        this.clientRegistry = clientRegistry;%0A    %7D%0A%0A    @Override%0A    public Health health() %7B%0A        int count = 0;%0A        int ready = 0;%0A        Map%3CString, Object%3E details = new LinkedHashMap%3C%3E();%0A        for (Map.Entry%3CBot, IDiscordClient%3E entry : clientRegistry.getClients().entrySet()) %7B%0A            count++;%0A            Map%3CString, Object%3E bot = new LinkedHashMap%3C%3E();%0A            IDiscordClient client = entry.getValue();%0A            if (client.isReady()) %7B%0A                ready++;%0A                bot.put(%22status%22, %22ready%22);%0A                bot.put(%22id%22, client.getOurUser().getID());%0A                bot.put(%22name%22, client.getOurUser().getName());%0A                bot.put(%22shards%22, client.getShardCount());%0A                bot.put(%22guilds%22, client.getGuilds().size());%0A                bot.put(%22channels%22, client.getChannels().size());%0A                bot.put(%22users%22, client.getUsers().size());%0A                bot.put(%22roles%22, client.getRoles().size());%0A            %7D else if (client.isLoggedIn()) %7B%0A                bot.put(%22status%22, %22logged-in%22);%0A            %7D else %7B%0A                bot.put(%22status%22, %22offline%22);%0A            %7D%0A            details.put(entry.getKey().getName(), bot);%0A        %7D%0A        Health.Builder builder = count == 0 ? Health.unknown() : (count == ready ? Health.up() : Health.outOfService());%0A        details.put(%22count%22, count);%0A        details.put(%22ready%22, ready);%0A        details.forEach(builder::withDetail);%0A        return builder.build();%0A    %7D%0A%7D%0A

Add bot health indicator