2023-08-21 10:58:17 -04:00
|
|
|
using System.Collections.Generic;
|
2024-03-31 23:57:12 -04:00
|
|
|
using System.Threading;
|
2023-08-21 10:58:17 -04:00
|
|
|
using System.Threading.Tasks;
|
2024-03-20 23:18:34 -04:00
|
|
|
using Luski.Shared.PublicServers.V1.Enums;
|
2023-08-21 10:58:17 -04:00
|
|
|
|
|
|
|
namespace Luski.net.Structures.Public;
|
|
|
|
|
|
|
|
public class Role
|
|
|
|
{
|
|
|
|
public required PublicServer Server { get; init; } = default!;
|
|
|
|
public required long ID { get; init; } = default!;
|
2024-08-27 10:57:22 -04:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2023-08-21 10:58:17 -04:00
|
|
|
private List<SocketUser>? RawUsers = null;
|
|
|
|
|
2024-03-31 23:57:12 -04:00
|
|
|
public async Task<SocketUser[]> GetMembers()
|
2023-08-21 10:58:17 -04:00
|
|
|
{
|
2024-08-27 10:57:22 -04:00
|
|
|
if (RawUsers is null || RawUsers.Count != MembersListID.Length)
|
2023-08-21 10:58:17 -04:00
|
|
|
{
|
2024-03-31 23:57:12 -04:00
|
|
|
RawUsers = new();
|
|
|
|
foreach (long m in MembersListID)
|
|
|
|
{
|
|
|
|
RawUsers.Add(await Server.GetUser<SocketUser>(m, CancellationToken.None));
|
|
|
|
}
|
2023-08-21 10:58:17 -04:00
|
|
|
}
|
|
|
|
|
2024-03-31 23:57:12 -04:00
|
|
|
return RawUsers!.ToArray();
|
2023-08-21 10:58:17 -04:00
|
|
|
}
|
|
|
|
}
|