From 2d9fc9893b05ce4d30060a1049cf708f72631b9a Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Tue, 30 May 2017 02:05:11 +0200 Subject: [PATCH] limit increased to 10 --- src/NadekoBot/Modules/Utility/Utility.cs | 2 -- src/NadekoBot/NadekoBot.cs | 2 +- src/NadekoBot/Services/Administration/RatelimitService.cs | 8 +++++--- src/NadekoBot/Services/Permissions/BlacklistService.cs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/NadekoBot/Modules/Utility/Utility.cs b/src/NadekoBot/Modules/Utility/Utility.cs index ae746cfb..2d1d2601 100644 --- a/src/NadekoBot/Modules/Utility/Utility.cs +++ b/src/NadekoBot/Modules/Utility/Utility.cs @@ -26,14 +26,12 @@ namespace NadekoBot.Modules.Utility private static ConcurrentDictionary _rotatingRoleColors = new ConcurrentDictionary(); private readonly DiscordShardedClient _client; private readonly IStatsService _stats; - //private readonly MusicService _music; private readonly IBotCredentials _creds; public Utility(DiscordShardedClient client, IStatsService stats, IBotCredentials creds) { _client = client; _stats = stats; - //_music = music; _creds = creds; } diff --git a/src/NadekoBot/NadekoBot.cs b/src/NadekoBot/NadekoBot.cs index 009763b2..8d1d6a44 100644 --- a/src/NadekoBot/NadekoBot.cs +++ b/src/NadekoBot/NadekoBot.cs @@ -135,7 +135,7 @@ namespace NadekoBot var vcRoleService = new VcRoleService(Client, AllGuildConfigs, Db); var vPlusTService = new VplusTService(Client, AllGuildConfigs, strings, Db); var muteService = new MuteService(Client, AllGuildConfigs, Db); - var ratelimitService = new SlowmodeService(AllGuildConfigs); + var ratelimitService = new SlowmodeService(Client, AllGuildConfigs); var protectionService = new ProtectionService(Client, AllGuildConfigs, muteService); var playingRotateService = new PlayingRotateService(Client, BotConfig, musicService); var gameVcService = new GameVoiceChannelService(Client, Db, AllGuildConfigs); diff --git a/src/NadekoBot/Services/Administration/RatelimitService.cs b/src/NadekoBot/Services/Administration/RatelimitService.cs index 8937761d..b344930f 100644 --- a/src/NadekoBot/Services/Administration/RatelimitService.cs +++ b/src/NadekoBot/Services/Administration/RatelimitService.cs @@ -19,10 +19,12 @@ namespace NadekoBot.Services.Administration public ConcurrentDictionary> IgnoredUsers = new ConcurrentDictionary>(); private readonly Logger _log; + private readonly DiscordShardedClient _client; - public SlowmodeService(IEnumerable gcs) + public SlowmodeService(DiscordShardedClient client, IEnumerable gcs) { _log = LogManager.GetCurrentClassLogger(); + _client = client; IgnoredRoles = new ConcurrentDictionary>( gcs.ToDictionary(x => x.GuildId, @@ -33,7 +35,7 @@ namespace NadekoBot.Services.Administration x => new HashSet(x.SlowmodeIgnoredUsers.Select(y => y.UserId)))); } - public async Task TryBlockEarly(DiscordShardedClient client, IGuild guild, IUserMessage usrMsg) + public async Task TryBlockEarly(IGuild guild, IUserMessage usrMsg) { if (guild == null) return false; @@ -41,7 +43,7 @@ namespace NadekoBot.Services.Administration { var channel = usrMsg?.Channel as SocketTextChannel; - if (channel == null || usrMsg == null || usrMsg.IsAuthor(client)) + if (channel == null || usrMsg == null || usrMsg.IsAuthor(_client)) return false; if (!RatelimitingChannels.TryGetValue(channel.Id, out Ratelimiter limiter)) return false; diff --git a/src/NadekoBot/Services/Permissions/BlacklistService.cs b/src/NadekoBot/Services/Permissions/BlacklistService.cs index 65324083..103d04e4 100644 --- a/src/NadekoBot/Services/Permissions/BlacklistService.cs +++ b/src/NadekoBot/Services/Permissions/BlacklistService.cs @@ -22,7 +22,7 @@ namespace NadekoBot.Services.Permissions BlacklistedChannels = new ConcurrentHashSet(blacklist.Where(bi => bi.Type == BlacklistType.Channel).Select(c => c.ItemId)); } - public Task TryBlockEarly(DiscordShardedClient client, IGuild guild, IUserMessage usrMsg) + public Task TryBlockEarly(IGuild guild, IUserMessage usrMsg) => Task.FromResult((guild != null && BlacklistedGuilds.Contains(guild.Id)) || BlacklistedChannels.Contains(usrMsg.Channel.Id) || BlacklistedUsers.Contains(usrMsg.Author.Id));