49 lines
1.4 KiB
C#
49 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));
|
|||
|
}
|
|||
|
}
|
|||
|
}
|