%shardid% %shardcount% and %shardguilds% added to .ropl

This commit is contained in:
Kwoth 2017-01-23 03:17:50 +01:00
parent 1769a2a553
commit 8b766655ac
4 changed files with 25 additions and 7 deletions

@ -1 +1 @@
Subproject commit 58766448d79ac9adec228f341f258aa262a3f278
Subproject commit 7c0cce6d35b04d883cf5ec2d775b051e4bc8739f

View File

@ -1,5 +1,6 @@
using Discord;
using Discord.Commands;
using Discord.WebSocket;
using NadekoBot.Attributes;
using NadekoBot.Extensions;
using NadekoBot.Services;
@ -50,7 +51,16 @@ namespace NadekoBot.Modules.Administration
if (string.IsNullOrWhiteSpace(status))
continue;
PlayingPlaceholders.ForEach(e => status = status.Replace(e.Key, e.Value()));
await NadekoBot.Client.SetGameAsync(status).ConfigureAwait(false);
var shards = NadekoBot.Client.Shards;
for (int i = 0; i < shards.Count; i++)
{
ShardSpecificPlaceholders.ForEach(e => status = status.Replace(e.Key, e.Value(shards.ElementAt(i))));
try { await shards.ElementAt(i).SetGameAsync(status).ConfigureAwait(false); }
catch (Exception ex)
{
_log.Warn(ex);
}
}
}
}
catch (Exception ex)
@ -82,7 +92,14 @@ namespace NadekoBot.Modules.Administration
}
},
{ "%queued%", () => Music.Music.MusicPlayers.Sum(kvp => kvp.Value.Playlist.Count).ToString()},
{ "%time%", () => DateTime.Now.ToString("hh:mm " + TimeZoneInfo.Local.StandardName.GetInitials()) }
{ "%time%", () => DateTime.Now.ToString("hh:mm " + TimeZoneInfo.Local.StandardName.GetInitials()) },
{ "%shardcount%", () => NadekoBot.Client.Shards.Count.ToString() },
};
public static Dictionary<string, Func<DiscordSocketClient, string>> ShardSpecificPlaceholders { get; } =
new Dictionary<string, Func<DiscordSocketClient, string>> {
{ "%shardid%", (client) => client.ShardId.ToString()},
{ "%shardguilds%", (client) => client.Guilds.Count.ToString()},
};
[NadekoCommand, Usage, Description, Aliases]

View File

@ -5118,7 +5118,7 @@ namespace NadekoBot.Resources {
}
/// <summary>
/// Looks up a localized string similar to Spend a unit of currency to plant it in this channel. (If bot is restarted or crashes, the currency will be lost).
/// Looks up a localized string similar to Spend an amount of currency to plant it in this channel. Default is 1. (If bot is restarted or crashes, the currency will be lost).
/// </summary>
public static string plant_desc {
get {
@ -5127,7 +5127,7 @@ namespace NadekoBot.Resources {
}
/// <summary>
/// Looks up a localized string similar to `{0}plant`.
/// Looks up a localized string similar to `{0}plant` or `{0}plant 5`.
/// </summary>
public static string plant_usage {
get {

View File

@ -1372,10 +1372,11 @@
<value>plant</value>
</data>
<data name="plant_desc" xml:space="preserve">
<value>Spend a unit of currency to plant it in this channel. (If bot is restarted or crashes, the currency will be lost)</value>
<value>Spend an amount of currency to plant it in this channel. Default is 1. (If bot is restarted or crashes, the currency will be lost)</value>
</data>
<data name="plant_usage" xml:space="preserve">
<value>`{0}plant`</value>
<value>`{0}plant` or `{0}plant 5`</value>
<comment> </comment>
</data>
<data name="gencurrency_cmd" xml:space="preserve">
<value>gencurrency gc</value>