foxcord/Foxcord/Gateway/Events/Dispatch/ReadyEvent.cs

18 lines
684 B
C#
Raw Permalink Normal View History

2024-09-03 00:07:12 +02:00
using System.Text.Json.Serialization;
using Foxcord.Models;
namespace Foxcord.Gateway.Events.Dispatch;
public class ReadyEvent : IDispatch
{
[JsonPropertyName("v")] public int Version { get; init; }
public required User User { get; init; }
public string? SessionId { get; init; }
public string? ResumeGatewayUrl { get; init; }
[JsonPropertyName("shard")] public int[]? RawShard { private get; init; }
[JsonIgnore] public ShardInfo Shard => new(RawShard?[0] ?? 0, RawShard?[1] ?? 1);
[JsonIgnore] public bool CanResume => !string.IsNullOrEmpty(SessionId) && !string.IsNullOrEmpty(ResumeGatewayUrl);
}
public record ShardInfo(int ShardId, int NumShards);