18 lines
No EOL
684 B
C#
18 lines
No EOL
684 B
C#
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); |