44 lines
1.3 KiB
C#
44 lines
1.3 KiB
C#
using System.Collections.Generic;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Luski.Shared.PublicServers.V1.Enums;
|
|
|
|
namespace Luski.net.Structures.Public;
|
|
|
|
public class Role
|
|
{
|
|
public required PublicServer Server { get; init; } = default!;
|
|
public required long ID { get; init; } = default!;
|
|
public int Index { get; internal set; } = default!;
|
|
public ColorType ColorType { get; internal set; } = ColorType.Full;
|
|
public Color[] Colors { get; internal set; } = default!;
|
|
public string Description { get; internal set; } = default!;
|
|
public string DisplayName { get; internal set; } = default!;
|
|
public ServerPermission ServerPermissions { get; internal set; } = default!;
|
|
public long[] MLID = default!;
|
|
|
|
public long[] MembersListID
|
|
{
|
|
get => MLID;
|
|
internal set
|
|
{
|
|
MLID = value;
|
|
RawUsers = null;
|
|
}
|
|
}
|
|
private List<SocketUser>? RawUsers = null;
|
|
|
|
public async Task<SocketUser[]> GetMembers()
|
|
{
|
|
if (RawUsers is null || RawUsers.Count != MembersListID.Length)
|
|
{
|
|
RawUsers = new();
|
|
foreach (long m in MembersListID)
|
|
{
|
|
RawUsers.Add(await Server.GetUser<SocketUser>(m, CancellationToken.None));
|
|
}
|
|
}
|
|
|
|
return RawUsers!.ToArray();
|
|
}
|
|
} |