Initial commit, basic proxying working
This commit is contained in:
6
Myriad/Gateway/Events/ChannelCreateEvent.cs
Normal file
6
Myriad/Gateway/Events/ChannelCreateEvent.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record ChannelCreateEvent: Channel, IGatewayEvent;
|
||||
}
|
||||
6
Myriad/Gateway/Events/ChannelDeleteEvent.cs
Normal file
6
Myriad/Gateway/Events/ChannelDeleteEvent.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record ChannelDeleteEvent: Channel, IGatewayEvent;
|
||||
}
|
||||
6
Myriad/Gateway/Events/ChannelUpdateEvent.cs
Normal file
6
Myriad/Gateway/Events/ChannelUpdateEvent.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record ChannelUpdateEvent: Channel, IGatewayEvent;
|
||||
}
|
||||
12
Myriad/Gateway/Events/GuildCreateEvent.cs
Normal file
12
Myriad/Gateway/Events/GuildCreateEvent.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record GuildCreateEvent: Guild, IGatewayEvent
|
||||
{
|
||||
public Channel[] Channels { get; init; }
|
||||
public GuildMember[] Members { get; init; }
|
||||
}
|
||||
}
|
||||
4
Myriad/Gateway/Events/GuildDeleteEvent.cs
Normal file
4
Myriad/Gateway/Events/GuildDeleteEvent.cs
Normal file
@@ -0,0 +1,4 @@
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record GuildDeleteEvent(ulong Id, bool Unavailable): IGatewayEvent;
|
||||
}
|
||||
9
Myriad/Gateway/Events/GuildMemberAddEvent.cs
Normal file
9
Myriad/Gateway/Events/GuildMemberAddEvent.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record GuildMemberAddEvent: GuildMember, IGatewayEvent
|
||||
{
|
||||
public ulong GuildId { get; init; }
|
||||
}
|
||||
}
|
||||
10
Myriad/Gateway/Events/GuildMemberRemoveEvent.cs
Normal file
10
Myriad/Gateway/Events/GuildMemberRemoveEvent.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public class GuildMemberRemoveEvent: IGatewayEvent
|
||||
{
|
||||
public ulong GuildId { get; init; }
|
||||
public User User { get; init; }
|
||||
}
|
||||
}
|
||||
9
Myriad/Gateway/Events/GuildMemberUpdateEvent.cs
Normal file
9
Myriad/Gateway/Events/GuildMemberUpdateEvent.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record GuildMemberUpdateEvent: GuildMember, IGatewayEvent
|
||||
{
|
||||
public ulong GuildId { get; init; }
|
||||
}
|
||||
}
|
||||
6
Myriad/Gateway/Events/GuildRoleCreateEvent.cs
Normal file
6
Myriad/Gateway/Events/GuildRoleCreateEvent.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record GuildRoleCreateEvent(ulong GuildId, Role Role): IGatewayEvent;
|
||||
}
|
||||
4
Myriad/Gateway/Events/GuildRoleDeleteEvent.cs
Normal file
4
Myriad/Gateway/Events/GuildRoleDeleteEvent.cs
Normal file
@@ -0,0 +1,4 @@
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record GuildRoleDeleteEvent(ulong GuildId, ulong RoleId): IGatewayEvent;
|
||||
}
|
||||
6
Myriad/Gateway/Events/GuildRoleUpdateEvent.cs
Normal file
6
Myriad/Gateway/Events/GuildRoleUpdateEvent.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record GuildRoleUpdateEvent(ulong GuildId, Role Role): IGatewayEvent;
|
||||
}
|
||||
6
Myriad/Gateway/Events/GuildUpdateEvent.cs
Normal file
6
Myriad/Gateway/Events/GuildUpdateEvent.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record GuildUpdateEvent: Guild, IGatewayEvent;
|
||||
}
|
||||
35
Myriad/Gateway/Events/IGatewayEvent.cs
Normal file
35
Myriad/Gateway/Events/IGatewayEvent.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public interface IGatewayEvent
|
||||
{
|
||||
public static readonly Dictionary<string, Type> EventTypes = new()
|
||||
{
|
||||
{"READY", typeof(ReadyEvent)},
|
||||
{"RESUMED", typeof(ResumedEvent)},
|
||||
{"GUILD_CREATE", typeof(GuildCreateEvent)},
|
||||
{"GUILD_UPDATE", typeof(GuildUpdateEvent)},
|
||||
{"GUILD_DELETE", typeof(GuildDeleteEvent)},
|
||||
{"GUILD_MEMBER_ADD", typeof(GuildMemberAddEvent)},
|
||||
{"GUILD_MEMBER_REMOVE", typeof(GuildMemberRemoveEvent)},
|
||||
{"GUILD_MEMBER_UPDATE", typeof(GuildMemberUpdateEvent)},
|
||||
{"GUILD_ROLE_CREATE", typeof(GuildRoleCreateEvent)},
|
||||
{"GUILD_ROLE_UPDATE", typeof(GuildRoleUpdateEvent)},
|
||||
{"GUILD_ROLE_DELETE", typeof(GuildRoleDeleteEvent)},
|
||||
{"CHANNEL_CREATE", typeof(ChannelCreateEvent)},
|
||||
{"CHANNEL_UPDATE", typeof(ChannelUpdateEvent)},
|
||||
{"CHANNEL_DELETE", typeof(ChannelDeleteEvent)},
|
||||
{"MESSAGE_CREATE", typeof(MessageCreateEvent)},
|
||||
{"MESSAGE_UPDATE", typeof(MessageUpdateEvent)},
|
||||
{"MESSAGE_DELETE", typeof(MessageDeleteEvent)},
|
||||
{"MESSAGE_DELETE_BULK", typeof(MessageDeleteBulkEvent)},
|
||||
{"MESSAGE_REACTION_ADD", typeof(MessageReactionAddEvent)},
|
||||
{"MESSAGE_REACTION_REMOVE", typeof(MessageReactionRemoveEvent)},
|
||||
{"MESSAGE_REACTION_REMOVE_ALL", typeof(MessageReactionRemoveAllEvent)},
|
||||
{"MESSAGE_REACTION_REMOVE_EMOJI", typeof(MessageReactionRemoveEmojiEvent)},
|
||||
{"INTERACTION_CREATE", typeof(InteractionCreateEvent)}
|
||||
};
|
||||
}
|
||||
}
|
||||
6
Myriad/Gateway/Events/InteractionCreateEvent.cs
Normal file
6
Myriad/Gateway/Events/InteractionCreateEvent.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record InteractionCreateEvent: Interaction, IGatewayEvent;
|
||||
}
|
||||
9
Myriad/Gateway/Events/MessageCreateEvent.cs
Normal file
9
Myriad/Gateway/Events/MessageCreateEvent.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record MessageCreateEvent: Message, IGatewayEvent
|
||||
{
|
||||
public GuildMemberPartial? Member { get; init; }
|
||||
}
|
||||
}
|
||||
4
Myriad/Gateway/Events/MessageDeleteBulkEvent.cs
Normal file
4
Myriad/Gateway/Events/MessageDeleteBulkEvent.cs
Normal file
@@ -0,0 +1,4 @@
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record MessageDeleteBulkEvent(ulong[] Ids, ulong ChannelId, ulong? GuildId): IGatewayEvent;
|
||||
}
|
||||
4
Myriad/Gateway/Events/MessageDeleteEvent.cs
Normal file
4
Myriad/Gateway/Events/MessageDeleteEvent.cs
Normal file
@@ -0,0 +1,4 @@
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record MessageDeleteEvent(ulong Id, ulong ChannelId, ulong? GuildId): IGatewayEvent;
|
||||
}
|
||||
8
Myriad/Gateway/Events/MessageReactionAddEvent.cs
Normal file
8
Myriad/Gateway/Events/MessageReactionAddEvent.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record MessageReactionAddEvent(ulong UserId, ulong ChannelId, ulong MessageId, ulong? GuildId,
|
||||
GuildMember? Member,
|
||||
Emoji Emoji): IGatewayEvent;
|
||||
}
|
||||
4
Myriad/Gateway/Events/MessageReactionRemoveAllEvent.cs
Normal file
4
Myriad/Gateway/Events/MessageReactionRemoveAllEvent.cs
Normal file
@@ -0,0 +1,4 @@
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record MessageReactionRemoveAllEvent(ulong ChannelId, ulong MessageId, ulong? GuildId): IGatewayEvent;
|
||||
}
|
||||
7
Myriad/Gateway/Events/MessageReactionRemoveEmojiEvent.cs
Normal file
7
Myriad/Gateway/Events/MessageReactionRemoveEmojiEvent.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record MessageReactionRemoveEmojiEvent
|
||||
(ulong ChannelId, ulong MessageId, ulong? GuildId, Emoji Emoji): IGatewayEvent;
|
||||
}
|
||||
7
Myriad/Gateway/Events/MessageReactionRemoveEvent.cs
Normal file
7
Myriad/Gateway/Events/MessageReactionRemoveEvent.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record MessageReactionRemoveEvent
|
||||
(ulong UserId, ulong ChannelId, ulong MessageId, ulong? GuildId, Emoji Emoji): IGatewayEvent;
|
||||
}
|
||||
7
Myriad/Gateway/Events/MessageUpdateEvent.cs
Normal file
7
Myriad/Gateway/Events/MessageUpdateEvent.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record MessageUpdateEvent(ulong Id, ulong ChannelId): IGatewayEvent
|
||||
{
|
||||
// TODO: lots of partials
|
||||
}
|
||||
}
|
||||
15
Myriad/Gateway/Events/ReadyEvent.cs
Normal file
15
Myriad/Gateway/Events/ReadyEvent.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record ReadyEvent: IGatewayEvent
|
||||
{
|
||||
[JsonPropertyName("v")] public int Version { get; init; }
|
||||
public User User { get; init; }
|
||||
public string SessionId { get; init; }
|
||||
public ShardInfo? Shard { get; init; }
|
||||
public ApplicationPartial Application { get; init; }
|
||||
}
|
||||
}
|
||||
4
Myriad/Gateway/Events/ResumedEvent.cs
Normal file
4
Myriad/Gateway/Events/ResumedEvent.cs
Normal file
@@ -0,0 +1,4 @@
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record ResumedEvent: IGatewayEvent;
|
||||
}
|
||||
Reference in New Issue
Block a user