limit increased to 10

This commit is contained in:
Master Kwoth 2017-05-30 02:05:11 +02:00
parent bb897fc43d
commit 2d9fc9893b
4 changed files with 7 additions and 7 deletions

View File

@ -26,14 +26,12 @@ namespace NadekoBot.Modules.Utility
private static ConcurrentDictionary<ulong, Timer> _rotatingRoleColors = new ConcurrentDictionary<ulong, Timer>();
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;
}

View File

@ -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);

View File

@ -19,10 +19,12 @@ namespace NadekoBot.Services.Administration
public ConcurrentDictionary<ulong, HashSet<ulong>> IgnoredUsers = new ConcurrentDictionary<ulong, HashSet<ulong>>();
private readonly Logger _log;
private readonly DiscordShardedClient _client;
public SlowmodeService(IEnumerable<GuildConfig> gcs)
public SlowmodeService(DiscordShardedClient client, IEnumerable<GuildConfig> gcs)
{
_log = LogManager.GetCurrentClassLogger();
_client = client;
IgnoredRoles = new ConcurrentDictionary<ulong, HashSet<ulong>>(
gcs.ToDictionary(x => x.GuildId,
@ -33,7 +35,7 @@ namespace NadekoBot.Services.Administration
x => new HashSet<ulong>(x.SlowmodeIgnoredUsers.Select(y => y.UserId))));
}
public async Task<bool> TryBlockEarly(DiscordShardedClient client, IGuild guild, IUserMessage usrMsg)
public async Task<bool> 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;

View File

@ -22,7 +22,7 @@ namespace NadekoBot.Services.Permissions
BlacklistedChannels = new ConcurrentHashSet<ulong>(blacklist.Where(bi => bi.Type == BlacklistType.Channel).Select(c => c.ItemId));
}
public Task<bool> TryBlockEarly(DiscordShardedClient client, IGuild guild, IUserMessage usrMsg)
public Task<bool> TryBlockEarly(IGuild guild, IUserMessage usrMsg)
=> Task.FromResult((guild != null && BlacklistedGuilds.Contains(guild.Id)) ||
BlacklistedChannels.Contains(usrMsg.Channel.Id) ||
BlacklistedUsers.Contains(usrMsg.Author.Id));