init
This commit is contained in:
commit
b3bf3a7c16
43 changed files with 2057 additions and 0 deletions
9
Foxcord/Gateway/Events/Dispatch/GuildCreateEvent.cs
Normal file
9
Foxcord/Gateway/Events/Dispatch/GuildCreateEvent.cs
Normal file
|
@ -0,0 +1,9 @@
|
|||
using Foxcord.Models;
|
||||
|
||||
namespace Foxcord.Gateway.Events.Dispatch;
|
||||
|
||||
public class GuildCreateEvent : Guild, IDispatch
|
||||
{
|
||||
public bool Unavailable { get; init; } = false;
|
||||
public int MemberCount { get; init; }
|
||||
}
|
13
Foxcord/Gateway/Events/Dispatch/IDispatch.cs
Normal file
13
Foxcord/Gateway/Events/Dispatch/IDispatch.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
namespace Foxcord.Gateway.Events.Dispatch;
|
||||
|
||||
public interface IDispatch
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static class DispatchEventTypeName
|
||||
{
|
||||
public const string Ready = "READY";
|
||||
public const string GuildCreate = "GUILD_CREATE";
|
||||
public const string MessageCreate = "MESSAGE_CREATE";
|
||||
}
|
8
Foxcord/Gateway/Events/Dispatch/MessageCreateEvent.cs
Normal file
8
Foxcord/Gateway/Events/Dispatch/MessageCreateEvent.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
using Foxcord.Models;
|
||||
|
||||
namespace Foxcord.Gateway.Events.Dispatch;
|
||||
|
||||
public class MessageCreateEvent : Message, IDispatch
|
||||
{
|
||||
|
||||
}
|
18
Foxcord/Gateway/Events/Dispatch/ReadyEvent.cs
Normal file
18
Foxcord/Gateway/Events/Dispatch/ReadyEvent.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
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);
|
8
Foxcord/Gateway/Events/DispatchEvent.cs
Normal file
8
Foxcord/Gateway/Events/DispatchEvent.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
using Foxcord.Gateway.Events.Dispatch;
|
||||
|
||||
namespace Foxcord.Gateway.Events;
|
||||
|
||||
internal class DispatchEvent : IGatewayEvent
|
||||
{
|
||||
public required IDispatch Payload { get; init; }
|
||||
}
|
5
Foxcord/Gateway/Events/HeartbeatEvent.cs
Normal file
5
Foxcord/Gateway/Events/HeartbeatEvent.cs
Normal file
|
@ -0,0 +1,5 @@
|
|||
namespace Foxcord.Gateway.Events;
|
||||
|
||||
internal class HeartbeatEvent : IGatewayEvent;
|
||||
|
||||
internal class HeartbeatAckEvent : IGatewayEvent;
|
6
Foxcord/Gateway/Events/HelloEvent.cs
Normal file
6
Foxcord/Gateway/Events/HelloEvent.cs
Normal file
|
@ -0,0 +1,6 @@
|
|||
namespace Foxcord.Gateway.Events;
|
||||
|
||||
internal class HelloEvent : IGatewayEvent
|
||||
{
|
||||
public int HeartbeatInterval { get; init; }
|
||||
}
|
6
Foxcord/Gateway/Events/IGatewayEvent.cs
Normal file
6
Foxcord/Gateway/Events/IGatewayEvent.cs
Normal file
|
@ -0,0 +1,6 @@
|
|||
namespace Foxcord.Gateway.Events;
|
||||
|
||||
internal interface IGatewayEvent
|
||||
{
|
||||
|
||||
}
|
15
Foxcord/Gateway/Events/IdentifyEvent.cs
Normal file
15
Foxcord/Gateway/Events/IdentifyEvent.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
namespace Foxcord.Gateway.Events;
|
||||
|
||||
public class IdentifyEvent : IGatewayEvent
|
||||
{
|
||||
public required string Token { get; init; }
|
||||
public IdentifyProperties Properties { get; init; } = new();
|
||||
public GatewayIntent Intents { get; init; }
|
||||
}
|
||||
|
||||
public class IdentifyProperties
|
||||
{
|
||||
public string Os { get; init; } = "Linux";
|
||||
public string Browser { get; init; } = "Foxcord";
|
||||
public string Device { get; init; } = "Foxcord";
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue