JacobTech
d8fbf281d0
I moved the two server types to their own classes to prevent API calls to a server, not of that type.
35 lines
946 B
C#
Executable File
35 lines
946 B
C#
Executable File
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();
|
|
list.Remove(Server.User.Id);
|
|
_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
|
|
{
|
|
|
|
}
|