diff --git a/Discord.Net b/Discord.Net index 0fd1e70a..9ce5c475 160000 --- a/Discord.Net +++ b/Discord.Net @@ -1 +1 @@ -Subproject commit 0fd1e70a22612ff9fa697dace96f22780080b01f +Subproject commit 9ce5c4757efc6cb6bb8959e851abcdcbe03217be diff --git a/src/NadekoBot/Modules/Administration/Commands/PlayingRotateCommands.cs b/src/NadekoBot/Modules/Administration/Commands/PlayingRotateCommands.cs index 7fff2dc6..371a6d6b 100644 --- a/src/NadekoBot/Modules/Administration/Commands/PlayingRotateCommands.cs +++ b/src/NadekoBot/Modules/Administration/Commands/PlayingRotateCommands.cs @@ -24,7 +24,12 @@ namespace NadekoBot.Modules.Administration public static List RotatingStatusMessages { get; } public static bool RotatingStatuses { get; private set; } = false; private static Timer _t { get; } - + + private class TimerState + { + public int Index { get; set; } = 0; + } + static PlayingRotateCommands() { _log = LogManager.GetCurrentClassLogger(); @@ -34,21 +39,21 @@ namespace NadekoBot.Modules.Administration - _t = new Timer(async (_) => + _t = new Timer(async (objState) => { - var index = 0; try { + var state = (TimerState)objState; if (!RotatingStatuses) return; else { - if (index >= RotatingStatusMessages.Count) - index = 0; + if (state.Index >= RotatingStatusMessages.Count) + state.Index = 0; if (!RotatingStatusMessages.Any()) return; - var status = RotatingStatusMessages[index++].Status; + var status = RotatingStatusMessages[state.Index++].Status; if (string.IsNullOrWhiteSpace(status)) return; PlayingPlaceholders.ForEach(e => status = status.Replace(e.Key, e.Value())); @@ -68,7 +73,7 @@ namespace NadekoBot.Modules.Administration { _log.Warn("Rotating playing status errored.\n" + ex); } - }, null, TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(1)); + }, new TimerState(), TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(1)); } public static Dictionary> PlayingPlaceholders { get; } = diff --git a/src/NadekoBot/Modules/Utility/Utility.cs b/src/NadekoBot/Modules/Utility/Utility.cs index ddb34011..01f91b67 100644 --- a/src/NadekoBot/Modules/Utility/Utility.cs +++ b/src/NadekoBot/Modules/Utility/Utility.cs @@ -301,6 +301,14 @@ namespace NadekoBot.Modules.Utility .ConfigureAwait(false); } + [NadekoCommand, Usage, Description, Aliases] + public async Task ShardId(ulong guildid) + { + var shardId = NadekoBot.Client.GetShardIdFor(guildid); + + await Context.Channel.SendConfirmAsync($"ShardId for **{guildid}** with {NadekoBot.Client.Shards.Count} total shards", shardId.ToString()).ConfigureAwait(false); + } + [NadekoCommand, Usage, Description, Aliases] public async Task Stats() {