Archived
1
0
Fork 0
This repository has been archived on 2024-05-21. You can view files and clone it, but cannot push or open issues or pull requests.
maki/Maki/MemberManager.cs

48 lines
1.4 KiB
C#

using System.Collections.Generic;
using System.Linq;
namespace Maki
{
internal sealed class MemberManager : BaseManager<DiscordMember>
{
internal MemberManager()
{
}
public DiscordMember Id(ulong user)
{
lock (Collection)
return Collection.Where(x => x.Server == null && x.User.Id == user).FirstOrDefault();
}
public DiscordMember Id(ulong server, ulong user)
{
lock (Collection)
return Collection.Where(x => x.Server.Id == server && x.User.Id == user).FirstOrDefault();
}
public DiscordMember Id(DiscordServer server, ulong user)
{
lock (Collection)
return Collection.Where(x => x.Server == server && x.User.Id == user).FirstOrDefault();
}
public DiscordMember Id(DiscordServer server, DiscordUser user)
{
lock (Collection)
return Collection.Where(x => x.Server == server && x.User == user).FirstOrDefault();
}
public IEnumerable<DiscordMember> Server(DiscordServer server)
{
lock (Collection)
return Collection.Where(x => x.Server == server);
}
public IEnumerable<DiscordMember> Role(DiscordRole role)
{
lock (Collection)
return Collection.Where(x => x.HasRole(role.Id));
}
}
}