30 lines
749 B
C#
30 lines
749 B
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace Maki
|
|
{
|
|
internal sealed class RoleManager : BaseManager<DiscordRole>
|
|
{
|
|
internal RoleManager()
|
|
{
|
|
}
|
|
|
|
public DiscordRole Id(ulong id)
|
|
{
|
|
lock (Collection)
|
|
return Collection.Where(x => x.Id == id).FirstOrDefault();
|
|
}
|
|
|
|
public bool Exists(ulong id)
|
|
{
|
|
lock (Collection)
|
|
return Collection.Where(x => x.Id == id).Count() > 0;
|
|
}
|
|
|
|
public IEnumerable<DiscordRole> Server(DiscordServer server)
|
|
{
|
|
lock (Collection)
|
|
return Collection.Where(x => x.Server == server).OrderByDescending(x => x.Position);
|
|
}
|
|
}
|
|
}
|