2023-07-03 23:24:35 -04:00
|
|
|
|
using Luski.net.JsonTypes.BaseTypes;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text.Json.Serialization;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
|
|
|
|
|
namespace Luski.net.Structures.Main;
|
|
|
|
|
|
|
|
|
|
public class MainSocketDMChannel : MainSocketTextChannel
|
|
|
|
|
{
|
|
|
|
|
public MainSocketRemoteUser User
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (_user is null)
|
|
|
|
|
{
|
|
|
|
|
var list = MemberIdList.ToList();
|
2023-07-08 09:06:13 -04:00
|
|
|
|
list.Remove(Server.User.Id);
|
2023-07-03 23:24:35 -04:00
|
|
|
|
_user = Server.GetUser<MainSocketRemoteUser>(list.FirstOrDefault(), CancellationToken.None).Result;
|
|
|
|
|
}
|
|
|
|
|
return _user;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public MainSocketRemoteUser _user = null!;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[JsonSerializable(typeof(MainSocketDMChannel))]
|
|
|
|
|
[JsonSourceGenerationOptions(
|
|
|
|
|
GenerationMode = JsonSourceGenerationMode.Default,
|
|
|
|
|
PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase,
|
|
|
|
|
WriteIndented = false)]
|
|
|
|
|
internal partial class MainSocketDMChannelContext : JsonSerializerContext
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|