diff --git a/src/NadekoBot/Modules/Administration/Commands/SelfCommands.cs b/src/NadekoBot/Modules/Administration/Commands/SelfCommands.cs
index 80356f73..fb316beb 100644
--- a/src/NadekoBot/Modules/Administration/Commands/SelfCommands.cs
+++ b/src/NadekoBot/Modules/Administration/Commands/SelfCommands.cs
@@ -16,6 +16,29 @@ namespace NadekoBot.Modules.Administration
[Group]
class SelfCommands : ModuleBase
{
+ [NadekoCommand, Usage, Description, Aliases]
+ [OwnerOnly]
+ public async Task ConnectShard(int shardid)
+ {
+ var shard = NadekoBot.Client.GetShard(shardid);
+
+ if (shard == null)
+ {
+ await Context.Channel.SendErrorAsync("No shard by that id found.").ConfigureAwait(false);
+ return;
+ }
+ try
+ {
+ await Context.Channel.SendConfirmAsync($"Shard **#{shardid}** reconnecting.").ConfigureAwait(false);
+ await shard.ConnectAsync().ConfigureAwait(false);
+ await Context.Channel.SendConfirmAsync($"Shard **#{shardid}** reconnected.").ConfigureAwait(false);
+ }
+ catch (Exception ex)
+ {
+ _log.Warn(ex);
+ }
+ }
+
[NadekoCommand, Usage, Description, Aliases]
[OwnerOnly]
public async Task Leave([Remainder] string guildStr)
diff --git a/src/NadekoBot/Modules/Utility/Utility.cs b/src/NadekoBot/Modules/Utility/Utility.cs
index 1c1af1e0..ddb34011 100644
--- a/src/NadekoBot/Modules/Utility/Utility.cs
+++ b/src/NadekoBot/Modules/Utility/Utility.cs
@@ -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]
diff --git a/src/NadekoBot/Resources/CommandStrings.Designer.cs b/src/NadekoBot/Resources/CommandStrings.Designer.cs
index 634991da..2be25567 100644
--- a/src/NadekoBot/Resources/CommandStrings.Designer.cs
+++ b/src/NadekoBot/Resources/CommandStrings.Designer.cs
@@ -1868,6 +1868,33 @@ namespace NadekoBot.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to connectshard.
+ ///
+ public static string connectshard_cmd {
+ get {
+ return ResourceManager.GetString("connectshard_cmd", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Try (re)connecting a shard with a certain shardid when it dies. No one knows will it work. Keep an eye on the console for errors..
+ ///
+ public static string connectshard_desc {
+ get {
+ return ResourceManager.GetString("connectshard_desc", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to `{0}connectshard 2`.
+ ///
+ public static string connectshard_usage {
+ get {
+ return ResourceManager.GetString("connectshard_usage", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to convert.
///
@@ -7025,6 +7052,33 @@ namespace NadekoBot.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to shardstats.
+ ///
+ public static string shardstats_cmd {
+ get {
+ return ResourceManager.GetString("shardstats_cmd", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Stats for shards. Paginated with 25 shards per page..
+ ///
+ public static string shardstats_desc {
+ get {
+ return ResourceManager.GetString("shardstats_desc", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to `{0}shardstats` or `{0}shardstats 2`.
+ ///
+ public static string shardstats_usage {
+ get {
+ return ResourceManager.GetString("shardstats_usage", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to shorten.
///
diff --git a/src/NadekoBot/Resources/CommandStrings.resx b/src/NadekoBot/Resources/CommandStrings.resx
index 9b0b01be..a0cd8924 100644
--- a/src/NadekoBot/Resources/CommandStrings.resx
+++ b/src/NadekoBot/Resources/CommandStrings.resx
@@ -3051,4 +3051,22 @@
`{0}reloadimages`
+
+ shardstats
+
+
+ Stats for shards. Paginated with 25 shards per page.
+
+
+ `{0}shardstats` or `{0}shardstats 2`
+
+
+ connectshard
+
+
+ Try (re)connecting a shard with a certain shardid when it dies. No one knows will it work. Keep an eye on the console for errors.
+
+
+ `{0}connectshard 2`
+
\ No newline at end of file