Shards will now show when they're unresponsive in .shardstats command

This commit is contained in:
Master Kwoth
2017-07-05 15:16:06 +02:00
parent 6b51dbd330
commit 9fddfe77c4
6 changed files with 16 additions and 7 deletions

View File

@ -270,7 +270,7 @@ namespace NadekoBot.Modules.Music
add += Format.Bold(GetText("queue_stopped", Format.Code(Prefix + "play"))) + "\n";
var mps = mp.MaxPlaytimeSeconds;
if (mps > 0)
add += Format.Bold(GetText("song_skips_after", TimeSpan.FromSeconds(mps).ToString("g"))) + "\n";
add += Format.Bold(GetText("song_skips_after", TimeSpan.FromSeconds(mps).ToString("HH\\:mm\\:ss"))) + "\n";
if (mp.RepeatCurrentSong)
add += "🔂 " + GetText("repeating_cur_song") + "\n";
else if (mp.Shuffle)

View File

@ -295,8 +295,13 @@ namespace NadekoBot.Modules.Utility
var allShardStrings = statuses
.Select(x =>
GetText("shard_stats_txt", x.ShardId.ToString(),
Format.Bold(x.ConnectionState.ToString()), Format.Bold(x.Guilds.ToString())))
{
var timeDiff = DateTime.UtcNow - x.Time;
if (timeDiff > TimeSpan.FromSeconds(20))
return $"Shard #{x.ShardId.ToString()} **UNRESPONSIVE** for {timeDiff.ToString(@"hh\:mm\:ss")}";
return GetText("shard_stats_txt", x.ShardId.ToString(),
Format.Bold(x.ConnectionState.ToString()), Format.Bold(x.Guilds.ToString()), timeDiff.ToString(@"hh\:mm\:ss"));
})
.ToArray();
await Context.Channel.SendPaginatedConfirmAsync(_client, page, (curPage) =>