fix shard status nullrefs
This commit is contained in:
parent
f1bcbd91a3
commit
d2ea530c10
@ -285,12 +285,14 @@ namespace NadekoBot.Modules.Utility
|
|||||||
{
|
{
|
||||||
if (--page < 0)
|
if (--page < 0)
|
||||||
return;
|
return;
|
||||||
|
var statuses = _bot.ShardCoord.Statuses.ToArray();
|
||||||
var status = string.Join(", ", _bot.ShardCoord.Statuses.GroupBy(x => x.ConnectionState)
|
var status = string.Join(", ", statuses
|
||||||
|
.Where(x => x != null)
|
||||||
|
.GroupBy(x => x.ConnectionState)
|
||||||
.Select(x => $"{x.Count()} {x.Key}")
|
.Select(x => $"{x.Count()} {x.Key}")
|
||||||
.ToArray());
|
.ToArray());
|
||||||
|
|
||||||
var allShardStrings = _bot.ShardCoord.Statuses
|
var allShardStrings = statuses
|
||||||
.Select(x =>
|
.Select(x =>
|
||||||
GetText("shard_stats_txt", x.ShardId.ToString(),
|
GetText("shard_stats_txt", x.ShardId.ToString(),
|
||||||
Format.Bold(x.ConnectionState.ToString()), Format.Bold(x.Guilds.ToString())))
|
Format.Bold(x.ConnectionState.ToString()), Format.Bold(x.Guilds.ToString())))
|
||||||
|
@ -64,6 +64,8 @@ namespace NadekoBot
|
|||||||
_log.Error(ex);
|
_log.Error(ex);
|
||||||
}
|
}
|
||||||
await Task.Run(() =>
|
await Task.Run(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
string input;
|
string input;
|
||||||
while ((input = Console.ReadLine()?.ToLowerInvariant()) != "quit")
|
while ((input = Console.ReadLine()?.ToLowerInvariant()) != "quit")
|
||||||
@ -72,6 +74,7 @@ namespace NadekoBot
|
|||||||
{
|
{
|
||||||
case "ls":
|
case "ls":
|
||||||
var groupStr = string.Join(",", Statuses
|
var groupStr = string.Join(",", Statuses
|
||||||
|
.ToArray()
|
||||||
.Where(x => x != null)
|
.Where(x => x != null)
|
||||||
.GroupBy(x => x.ConnectionState)
|
.GroupBy(x => x.ConnectionState)
|
||||||
.Select(x => x.Count() + " " + x.Key));
|
.Select(x => x.Count() + " " + x.Key));
|
||||||
@ -81,6 +84,11 @@ namespace NadekoBot
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_log.Warn(ex);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
foreach (var p in ShardProcesses)
|
foreach (var p in ShardProcesses)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user