.shardstats added
This commit is contained in:
parent
d39e544567
commit
1fe9f596fd
@ -279,11 +279,41 @@ namespace NadekoBot.Modules.Utility
|
||||
await Context.Channel.SendConfirmAsync($"{Context.User.Mention} https://discord.gg/{invite.Code}");
|
||||
}
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
public async Task ShardStats(int page = 1)
|
||||
{
|
||||
page -= 1;
|
||||
if (page < 0)
|
||||
return;
|
||||
|
||||
var shards = NadekoBot.Client.Shards.Skip(page * 25).Take(25);
|
||||
|
||||
var info = string.Join("\n",
|
||||
shards.Select(x => $"Shard **#{x.ShardId.ToString()}** is in {Format.Bold(x.ConnectionState.ToString())} state with {Format.Bold(x.Guilds.Count.ToString())} servers"));
|
||||
|
||||
if (string.IsNullOrWhiteSpace(info))
|
||||
info = "No shard stats on this page.";
|
||||
|
||||
await Context.Channel.EmbedAsync(new EmbedBuilder()
|
||||
.WithOkColor()
|
||||
.WithTitle("Shard Stats - page " + (page + 1))
|
||||
.WithDescription(info))
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
public async Task Stats()
|
||||
{
|
||||
var stats = NadekoBot.Stats;
|
||||
|
||||
var shardId = Context.Guild != null
|
||||
? NadekoBot.Client.GetShardIdFor(Context.Guild.Id)
|
||||
: 0;
|
||||
var footer = $"Shard {shardId} | {NadekoBot.Client.Shards.Count} total shards";
|
||||
#if !GLOBAL_NADEKO
|
||||
footer += $" | Playing {Music.Music.MusicPlayers.Where(mp => mp.Value.CurrentSong != null).Count()} songs, {Music.Music.MusicPlayers.Sum(mp => mp.Value.Playlist.Count)} queued.";
|
||||
#endif
|
||||
|
||||
await Context.Channel.EmbedAsync(
|
||||
new EmbedBuilder().WithOkColor()
|
||||
.WithAuthor(eab => eab.WithName($"NadekoBot v{StatsService.BotVersion}")
|
||||
@ -298,10 +328,7 @@ namespace NadekoBot.Modules.Utility
|
||||
.AddField(efb => efb.WithName(Format.Bold("Owner ID(s)")).WithValue(string.Join("\n", NadekoBot.Credentials.OwnerIds)).WithIsInline(true))
|
||||
.AddField(efb => efb.WithName(Format.Bold("Uptime")).WithValue(stats.GetUptimeString("\n")).WithIsInline(true))
|
||||
.AddField(efb => efb.WithName(Format.Bold("Presence")).WithValue($"{NadekoBot.Client.GetGuildCount()} Servers\n{stats.TextChannels} Text Channels\n{stats.VoiceChannels} Voice Channels").WithIsInline(true))
|
||||
#if !GLOBAL_NADEKO
|
||||
.WithFooter(efb => efb.WithText($"Playing {Music.Music.MusicPlayers.Where(mp => mp.Value.CurrentSong != null).Count()} songs, {Music.Music.MusicPlayers.Sum(mp => mp.Value.Playlist.Count)} queued."))
|
||||
#endif
|
||||
);
|
||||
.WithFooter(efb => efb.WithText(footer)));
|
||||
}
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
|
27
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
27
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
@ -7025,6 +7025,33 @@ namespace NadekoBot.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to shardstats.
|
||||
/// </summary>
|
||||
public static string shardstats_cmd {
|
||||
get {
|
||||
return ResourceManager.GetString("shardstats_cmd", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Stats for shards. Paginated with 25 shards per page..
|
||||
/// </summary>
|
||||
public static string shardstats_desc {
|
||||
get {
|
||||
return ResourceManager.GetString("shardstats_desc", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to `{0}shardstats` or `{0}shardstats 2`.
|
||||
/// </summary>
|
||||
public static string shardstats_usage {
|
||||
get {
|
||||
return ResourceManager.GetString("shardstats_usage", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to shorten.
|
||||
/// </summary>
|
||||
|
@ -3051,4 +3051,13 @@
|
||||
<data name="reloadimages_usage" xml:space="preserve">
|
||||
<value>`{0}reloadimages`</value>
|
||||
</data>
|
||||
<data name="shardstats_cmd" xml:space="preserve">
|
||||
<value>shardstats</value>
|
||||
</data>
|
||||
<data name="shardstats_desc" xml:space="preserve">
|
||||
<value>Stats for shards. Paginated with 25 shards per page.</value>
|
||||
</data>
|
||||
<data name="shardstats_usage" xml:space="preserve">
|
||||
<value>`{0}shardstats` or `{0}shardstats 2`</value>
|
||||
</data>
|
||||
</root>
|
Loading…
Reference in New Issue
Block a user