From 857e20b601d40fbf3df50ddaec0bb81d865bda64 Mon Sep 17 00:00:00 2001 From: spiral Date: Fri, 11 Mar 2022 17:51:04 -0500 Subject: [PATCH] feat: show total shards from cluster configuration if present --- PluralKit.Bot/BotConfig.cs | 1 + PluralKit.Bot/Commands/Misc.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/PluralKit.Bot/BotConfig.cs b/PluralKit.Bot/BotConfig.cs index 19d9316d..8172d8a5 100644 --- a/PluralKit.Bot/BotConfig.cs +++ b/PluralKit.Bot/BotConfig.cs @@ -30,6 +30,7 @@ public class BotConfig public record ClusterSettings { + // this is zero-indexed public string NodeName { get; set; } public int TotalShards { get; set; } public int TotalNodes { get; set; } diff --git a/PluralKit.Bot/Commands/Misc.cs b/PluralKit.Bot/Commands/Misc.cs index fa618f7a..aecc3d4d 100644 --- a/PluralKit.Bot/Commands/Misc.cs +++ b/PluralKit.Bot/Commands/Misc.cs @@ -100,7 +100,7 @@ public class Misc var now = SystemClock.Instance.GetCurrentInstant().ToUnixTimeSeconds(); var shardUptime = Duration.FromSeconds(now - shardInfo?.LastConnection ?? 0); - var shardTotal = shards.Count(); + var shardTotal = _botConfig.Cluster?.TotalShards ?? shards.Count(); int shardClusterTotal = ctx.Cluster.Shards.Count; var shardUpTotal = shards.Where(x => x.Up).Count();