commit
5df79ddba9
@ -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)
|
||||
|
@ -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]
|
||||
|
54
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
54
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
@ -1868,6 +1868,33 @@ namespace NadekoBot.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to connectshard.
|
||||
/// </summary>
|
||||
public static string connectshard_cmd {
|
||||
get {
|
||||
return ResourceManager.GetString("connectshard_cmd", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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..
|
||||
/// </summary>
|
||||
public static string connectshard_desc {
|
||||
get {
|
||||
return ResourceManager.GetString("connectshard_desc", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to `{0}connectshard 2`.
|
||||
/// </summary>
|
||||
public static string connectshard_usage {
|
||||
get {
|
||||
return ResourceManager.GetString("connectshard_usage", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to convert.
|
||||
/// </summary>
|
||||
@ -7025,6 +7052,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,22 @@
|
||||
<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>
|
||||
<data name="connectshard_cmd" xml:space="preserve">
|
||||
<value>connectshard</value>
|
||||
</data>
|
||||
<data name="connectshard_desc" xml:space="preserve">
|
||||
<value>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.</value>
|
||||
</data>
|
||||
<data name="connectshard_usage" xml:space="preserve">
|
||||
<value>`{0}connectshard 2`</value>
|
||||
</data>
|
||||
</root>
|
Loading…
Reference in New Issue
Block a user