limit increased to 10
This commit is contained in:
parent
bb897fc43d
commit
2d9fc9893b
@ -26,14 +26,12 @@ namespace NadekoBot.Modules.Utility
|
|||||||
private static ConcurrentDictionary<ulong, Timer> _rotatingRoleColors = new ConcurrentDictionary<ulong, Timer>();
|
private static ConcurrentDictionary<ulong, Timer> _rotatingRoleColors = new ConcurrentDictionary<ulong, Timer>();
|
||||||
private readonly DiscordShardedClient _client;
|
private readonly DiscordShardedClient _client;
|
||||||
private readonly IStatsService _stats;
|
private readonly IStatsService _stats;
|
||||||
//private readonly MusicService _music;
|
|
||||||
private readonly IBotCredentials _creds;
|
private readonly IBotCredentials _creds;
|
||||||
|
|
||||||
public Utility(DiscordShardedClient client, IStatsService stats, IBotCredentials creds)
|
public Utility(DiscordShardedClient client, IStatsService stats, IBotCredentials creds)
|
||||||
{
|
{
|
||||||
_client = client;
|
_client = client;
|
||||||
_stats = stats;
|
_stats = stats;
|
||||||
//_music = music;
|
|
||||||
_creds = creds;
|
_creds = creds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ namespace NadekoBot
|
|||||||
var vcRoleService = new VcRoleService(Client, AllGuildConfigs, Db);
|
var vcRoleService = new VcRoleService(Client, AllGuildConfigs, Db);
|
||||||
var vPlusTService = new VplusTService(Client, AllGuildConfigs, strings, Db);
|
var vPlusTService = new VplusTService(Client, AllGuildConfigs, strings, Db);
|
||||||
var muteService = new MuteService(Client, AllGuildConfigs, 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 protectionService = new ProtectionService(Client, AllGuildConfigs, muteService);
|
||||||
var playingRotateService = new PlayingRotateService(Client, BotConfig, musicService);
|
var playingRotateService = new PlayingRotateService(Client, BotConfig, musicService);
|
||||||
var gameVcService = new GameVoiceChannelService(Client, Db, AllGuildConfigs);
|
var gameVcService = new GameVoiceChannelService(Client, Db, AllGuildConfigs);
|
||||||
|
@ -19,10 +19,12 @@ namespace NadekoBot.Services.Administration
|
|||||||
public ConcurrentDictionary<ulong, HashSet<ulong>> IgnoredUsers = new ConcurrentDictionary<ulong, HashSet<ulong>>();
|
public ConcurrentDictionary<ulong, HashSet<ulong>> IgnoredUsers = new ConcurrentDictionary<ulong, HashSet<ulong>>();
|
||||||
|
|
||||||
private readonly Logger _log;
|
private readonly Logger _log;
|
||||||
|
private readonly DiscordShardedClient _client;
|
||||||
|
|
||||||
public SlowmodeService(IEnumerable<GuildConfig> gcs)
|
public SlowmodeService(DiscordShardedClient client, IEnumerable<GuildConfig> gcs)
|
||||||
{
|
{
|
||||||
_log = LogManager.GetCurrentClassLogger();
|
_log = LogManager.GetCurrentClassLogger();
|
||||||
|
_client = client;
|
||||||
|
|
||||||
IgnoredRoles = new ConcurrentDictionary<ulong, HashSet<ulong>>(
|
IgnoredRoles = new ConcurrentDictionary<ulong, HashSet<ulong>>(
|
||||||
gcs.ToDictionary(x => x.GuildId,
|
gcs.ToDictionary(x => x.GuildId,
|
||||||
@ -33,7 +35,7 @@ namespace NadekoBot.Services.Administration
|
|||||||
x => new HashSet<ulong>(x.SlowmodeIgnoredUsers.Select(y => y.UserId))));
|
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)
|
if (guild == null)
|
||||||
return false;
|
return false;
|
||||||
@ -41,7 +43,7 @@ namespace NadekoBot.Services.Administration
|
|||||||
{
|
{
|
||||||
var channel = usrMsg?.Channel as SocketTextChannel;
|
var channel = usrMsg?.Channel as SocketTextChannel;
|
||||||
|
|
||||||
if (channel == null || usrMsg == null || usrMsg.IsAuthor(client))
|
if (channel == null || usrMsg == null || usrMsg.IsAuthor(_client))
|
||||||
return false;
|
return false;
|
||||||
if (!RatelimitingChannels.TryGetValue(channel.Id, out Ratelimiter limiter))
|
if (!RatelimitingChannels.TryGetValue(channel.Id, out Ratelimiter limiter))
|
||||||
return false;
|
return false;
|
||||||
|
@ -22,7 +22,7 @@ namespace NadekoBot.Services.Permissions
|
|||||||
BlacklistedChannels = new ConcurrentHashSet<ulong>(blacklist.Where(bi => bi.Type == BlacklistType.Channel).Select(c => c.ItemId));
|
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)) ||
|
=> Task.FromResult((guild != null && BlacklistedGuilds.Contains(guild.Id)) ||
|
||||||
BlacklistedChannels.Contains(usrMsg.Channel.Id) ||
|
BlacklistedChannels.Contains(usrMsg.Channel.Id) ||
|
||||||
BlacklistedUsers.Contains(usrMsg.Author.Id));
|
BlacklistedUsers.Contains(usrMsg.Author.Id));
|
||||||
|
Loading…
Reference in New Issue
Block a user