diff --git a/docs/Permissions System.md b/docs/Permissions System.md index 64b76207..32ad3407 100644 --- a/docs/Permissions System.md +++ b/docs/Permissions System.md @@ -49,11 +49,11 @@ To allow users to only see the current song and have a DJ role for queuing follo * Disables music commands for everybody -2. `.sc !!nowplaying enable` +2. `.sc .nowplaying enable` * Enables the "nowplaying" command for everyone -3. `.sc !!listqueue enable` +3. `.sc .listqueue enable` * Enables the "listqueue" command for everyone diff --git a/src/NadekoBot/Modules/Utility/Utility.cs b/src/NadekoBot/Modules/Utility/Utility.cs index d3f0e112..82c8551e 100644 --- a/src/NadekoBot/Modules/Utility/Utility.cs +++ b/src/NadekoBot/Modules/Utility/Utility.cs @@ -24,7 +24,6 @@ namespace NadekoBot.Modules.Utility { public partial class Utility : NadekoTopLevelModule { - private static ConcurrentDictionary _rotatingRoleColors = new ConcurrentDictionary(); private readonly DiscordSocketClient _client; private readonly IStatsService _stats; private readonly IBotCredentials _creds; @@ -36,71 +35,6 @@ namespace NadekoBot.Modules.Utility _stats = stats; _creds = creds; _shardCoord = nadeko.ShardCoord; - } - - [NadekoCommand, Usage, Description, Aliases] - [RequireContext(ContextType.Guild)] - [RequireUserPermission(GuildPermission.ManageRoles)] - [OwnerOnly] - public async Task RotateRoleColor(int timeout, IRole role, params string[] hexes) - { - var channel = (ITextChannel)Context.Channel; - - if ((timeout < 60 && timeout != 0) || timeout > 3600) - return; - - Timer t; - if (timeout == 0 || hexes.Length == 0) - { - if (_rotatingRoleColors.TryRemove(role.Id, out t)) - { - t.Change(Timeout.Infinite, Timeout.Infinite); - await ReplyConfirmLocalized("rrc_stop", Format.Bold(role.Name)).ConfigureAwait(false); - } - return; - } - - var hexColors = hexes.Select(hex => - { - try { return (Rgba32?)Rgba32.FromHex(hex.Replace("#", "")); } catch { return null; } - }) - .Where(c => c != null) - .Select(c => c.Value) - .ToArray(); - - if (!hexColors.Any()) - { - await ReplyErrorLocalized("rrc_no_colors").ConfigureAwait(false); - return; - } - - var images = hexColors.Select(color => - { - var img = new ImageSharp.Image(50, 50); - img.BackgroundColor(color); - return img; - }).Merge().ToStream(); - - var i = 0; - t = new Timer(async (_) => - { - try - { - var color = hexColors[i]; - await role.ModifyAsync(r => r.Color = new Color(color.R, color.G, color.B)).ConfigureAwait(false); - ++i; - if (i >= hexColors.Length) - i = 0; - } - catch { } - }, null, 0, timeout * 1000); - - _rotatingRoleColors.AddOrUpdate(role.Id, t, (key, old) => - { - old.Change(Timeout.Infinite, Timeout.Infinite); - return t; - }); - await channel.SendFileAsync(images, "magicalgirl.jpg", GetText("rrc_start", Format.Bold(role.Name))).ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -430,4 +364,4 @@ namespace NadekoBot.Modules.Utility await Context.Channel.SendConfirmAsync($"{Format.Bold(Context.User.ToString())} 🏓 {(int)sw.Elapsed.TotalMilliseconds}ms").ConfigureAwait(false); } } -} \ No newline at end of file +}