Changed ids to uint64s
This commit is contained in:
@@ -4,7 +4,7 @@ namespace Discord.Commands.Permissions.Userlist
|
||||
{
|
||||
public class BlacklistService : UserlistService
|
||||
{
|
||||
public BlacklistService(IEnumerable<long> initialList = null)
|
||||
public BlacklistService(IEnumerable<ulong> initialList = null)
|
||||
: base(initialList)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -7,39 +7,39 @@ namespace Discord.Commands.Permissions.Userlist
|
||||
{
|
||||
public class UserlistService : IService
|
||||
{
|
||||
protected readonly ConcurrentDictionary<long, bool> _userList;
|
||||
protected readonly ConcurrentDictionary<ulong, bool> _userList;
|
||||
private DiscordClient _client;
|
||||
|
||||
public DiscordClient Client => _client;
|
||||
public IEnumerable<long> UserIds => _userList.Select(x => x.Key);
|
||||
public IEnumerable<ulong> UserIds => _userList.Select(x => x.Key);
|
||||
|
||||
public UserlistService(IEnumerable<long> initialList = null)
|
||||
public UserlistService(IEnumerable<ulong> initialList = null)
|
||||
{
|
||||
if (initialList != null)
|
||||
_userList = new ConcurrentDictionary<long, bool>(initialList.Select(x => new KeyValuePair<long, bool>(x, true)));
|
||||
_userList = new ConcurrentDictionary<ulong, bool>(initialList.Select(x => new KeyValuePair<ulong, bool>(x, true)));
|
||||
else
|
||||
_userList = new ConcurrentDictionary<long, bool>();
|
||||
_userList = new ConcurrentDictionary<ulong, bool>();
|
||||
}
|
||||
|
||||
public void Add(User user)
|
||||
{
|
||||
if (user == null) throw new ArgumentNullException(nameof(user));
|
||||
|
||||
_userList[user.Id] = true;
|
||||
}
|
||||
public void Add(long userId)
|
||||
public void Add(ulong userId)
|
||||
{
|
||||
if (userId <= 0) throw new ArgumentOutOfRangeException(nameof(userId));
|
||||
_userList[userId] = true;
|
||||
}
|
||||
public bool Remove(User user)
|
||||
{
|
||||
if (user == null) throw new ArgumentNullException(nameof(user));
|
||||
|
||||
bool ignored;
|
||||
return _userList.TryRemove(user.Id, out ignored);
|
||||
}
|
||||
public bool Remove(long userId)
|
||||
public bool Remove(ulong userId)
|
||||
{
|
||||
if (userId <= 0) throw new ArgumentOutOfRangeException(nameof(userId));
|
||||
bool ignored;
|
||||
return _userList.TryRemove(userId, out ignored);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Discord.Commands.Permissions.Userlist
|
||||
{
|
||||
public class WhitelistService : UserlistService
|
||||
{
|
||||
public WhitelistService(IEnumerable<long> initialList = null)
|
||||
public WhitelistService(IEnumerable<ulong> initialList = null)
|
||||
: base(initialList)
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user