feat: upgrade to .NET 6, refactor everything
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record ChannelCreateEvent: Channel, IGatewayEvent;
|
||||
}
|
||||
namespace Myriad.Gateway;
|
||||
|
||||
public record ChannelCreateEvent: Channel, IGatewayEvent;
|
@@ -1,6 +1,5 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record ChannelDeleteEvent: Channel, IGatewayEvent;
|
||||
}
|
||||
namespace Myriad.Gateway;
|
||||
|
||||
public record ChannelDeleteEvent: Channel, IGatewayEvent;
|
@@ -1,6 +1,5 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record ChannelUpdateEvent: Channel, IGatewayEvent;
|
||||
}
|
||||
namespace Myriad.Gateway;
|
||||
|
||||
public record ChannelUpdateEvent: Channel, IGatewayEvent;
|
@@ -1,11 +1,10 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
namespace Myriad.Gateway;
|
||||
|
||||
public record GuildCreateEvent: Guild, IGatewayEvent
|
||||
{
|
||||
public record GuildCreateEvent: Guild, IGatewayEvent
|
||||
{
|
||||
public Channel[] Channels { get; init; }
|
||||
public GuildMember[] Members { get; init; }
|
||||
public Channel[] Threads { get; init; }
|
||||
}
|
||||
public Channel[] Channels { get; init; }
|
||||
public GuildMember[] Members { get; init; }
|
||||
public Channel[] Threads { get; init; }
|
||||
}
|
@@ -1,4 +1,3 @@
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record GuildDeleteEvent(ulong Id, bool Unavailable): IGatewayEvent;
|
||||
}
|
||||
namespace Myriad.Gateway;
|
||||
|
||||
public record GuildDeleteEvent(ulong Id, bool Unavailable): IGatewayEvent;
|
@@ -1,9 +1,8 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
namespace Myriad.Gateway;
|
||||
|
||||
public record GuildMemberAddEvent: GuildMember, IGatewayEvent
|
||||
{
|
||||
public record GuildMemberAddEvent: GuildMember, IGatewayEvent
|
||||
{
|
||||
public ulong GuildId { get; init; }
|
||||
}
|
||||
public ulong GuildId { get; init; }
|
||||
}
|
@@ -1,10 +1,9 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
namespace Myriad.Gateway;
|
||||
|
||||
public class GuildMemberRemoveEvent: IGatewayEvent
|
||||
{
|
||||
public class GuildMemberRemoveEvent: IGatewayEvent
|
||||
{
|
||||
public ulong GuildId { get; init; }
|
||||
public User User { get; init; }
|
||||
}
|
||||
public ulong GuildId { get; init; }
|
||||
public User User { get; init; }
|
||||
}
|
@@ -1,9 +1,8 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
namespace Myriad.Gateway;
|
||||
|
||||
public record GuildMemberUpdateEvent: GuildMember, IGatewayEvent
|
||||
{
|
||||
public record GuildMemberUpdateEvent: GuildMember, IGatewayEvent
|
||||
{
|
||||
public ulong GuildId { get; init; }
|
||||
}
|
||||
public ulong GuildId { get; init; }
|
||||
}
|
@@ -1,6 +1,5 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record GuildRoleCreateEvent(ulong GuildId, Role Role): IGatewayEvent;
|
||||
}
|
||||
namespace Myriad.Gateway;
|
||||
|
||||
public record GuildRoleCreateEvent(ulong GuildId, Role Role): IGatewayEvent;
|
@@ -1,4 +1,3 @@
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record GuildRoleDeleteEvent(ulong GuildId, ulong RoleId): IGatewayEvent;
|
||||
}
|
||||
namespace Myriad.Gateway;
|
||||
|
||||
public record GuildRoleDeleteEvent(ulong GuildId, ulong RoleId): IGatewayEvent;
|
@@ -1,6 +1,5 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record GuildRoleUpdateEvent(ulong GuildId, Role Role): IGatewayEvent;
|
||||
}
|
||||
namespace Myriad.Gateway;
|
||||
|
||||
public record GuildRoleUpdateEvent(ulong GuildId, Role Role): IGatewayEvent;
|
@@ -1,6 +1,5 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record GuildUpdateEvent: Guild, IGatewayEvent;
|
||||
}
|
||||
namespace Myriad.Gateway;
|
||||
|
||||
public record GuildUpdateEvent: Guild, IGatewayEvent;
|
@@ -1,39 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
namespace Myriad.Gateway;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
public interface IGatewayEvent
|
||||
{
|
||||
public interface IGatewayEvent
|
||||
public static readonly Dictionary<string, Type> EventTypes = new()
|
||||
{
|
||||
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) },
|
||||
{ "THREAD_CREATE", typeof(ThreadCreateEvent) },
|
||||
{ "THREAD_UPDATE", typeof(ThreadUpdateEvent) },
|
||||
{ "THREAD_DELETE", typeof(ThreadDeleteEvent) },
|
||||
{ "THREAD_LIST_SYNC", typeof(ThreadListSyncEvent) },
|
||||
{ "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) }
|
||||
};
|
||||
}
|
||||
{ "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) },
|
||||
{ "THREAD_CREATE", typeof(ThreadCreateEvent) },
|
||||
{ "THREAD_UPDATE", typeof(ThreadUpdateEvent) },
|
||||
{ "THREAD_DELETE", typeof(ThreadDeleteEvent) },
|
||||
{ "THREAD_LIST_SYNC", typeof(ThreadListSyncEvent) },
|
||||
{ "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) }
|
||||
};
|
||||
}
|
@@ -1,6 +1,5 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record InteractionCreateEvent: Interaction, IGatewayEvent;
|
||||
}
|
||||
namespace Myriad.Gateway;
|
||||
|
||||
public record InteractionCreateEvent: Interaction, IGatewayEvent;
|
@@ -1,9 +1,8 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
namespace Myriad.Gateway;
|
||||
|
||||
public record MessageCreateEvent: Message, IGatewayEvent
|
||||
{
|
||||
public record MessageCreateEvent: Message, IGatewayEvent
|
||||
{
|
||||
public GuildMemberPartial? Member { get; init; }
|
||||
}
|
||||
public GuildMemberPartial? Member { get; init; }
|
||||
}
|
@@ -1,4 +1,3 @@
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record MessageDeleteBulkEvent(ulong[] Ids, ulong ChannelId, ulong? GuildId): IGatewayEvent;
|
||||
}
|
||||
namespace Myriad.Gateway;
|
||||
|
||||
public record MessageDeleteBulkEvent(ulong[] Ids, ulong ChannelId, ulong? GuildId): IGatewayEvent;
|
@@ -1,4 +1,3 @@
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record MessageDeleteEvent(ulong Id, ulong ChannelId, ulong? GuildId): IGatewayEvent;
|
||||
}
|
||||
namespace Myriad.Gateway;
|
||||
|
||||
public record MessageDeleteEvent(ulong Id, ulong ChannelId, ulong? GuildId): IGatewayEvent;
|
@@ -1,8 +1,7 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record MessageReactionAddEvent(ulong UserId, ulong ChannelId, ulong MessageId, ulong? GuildId,
|
||||
GuildMember? Member,
|
||||
Emoji Emoji): IGatewayEvent;
|
||||
}
|
||||
namespace Myriad.Gateway;
|
||||
|
||||
public record MessageReactionAddEvent(ulong UserId, ulong ChannelId, ulong MessageId, ulong? GuildId,
|
||||
GuildMember? Member,
|
||||
Emoji Emoji): IGatewayEvent;
|
@@ -1,4 +1,3 @@
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record MessageReactionRemoveAllEvent(ulong ChannelId, ulong MessageId, ulong? GuildId): IGatewayEvent;
|
||||
}
|
||||
namespace Myriad.Gateway;
|
||||
|
||||
public record MessageReactionRemoveAllEvent(ulong ChannelId, ulong MessageId, ulong? GuildId): IGatewayEvent;
|
@@ -1,7 +1,6 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record MessageReactionRemoveEmojiEvent
|
||||
(ulong ChannelId, ulong MessageId, ulong? GuildId, Emoji Emoji): IGatewayEvent;
|
||||
}
|
||||
namespace Myriad.Gateway;
|
||||
|
||||
public record MessageReactionRemoveEmojiEvent
|
||||
(ulong ChannelId, ulong MessageId, ulong? GuildId, Emoji Emoji): IGatewayEvent;
|
@@ -1,7 +1,6 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record MessageReactionRemoveEvent
|
||||
(ulong UserId, ulong ChannelId, ulong MessageId, ulong? GuildId, Emoji Emoji): IGatewayEvent;
|
||||
}
|
||||
namespace Myriad.Gateway;
|
||||
|
||||
public record MessageReactionRemoveEvent
|
||||
(ulong UserId, ulong ChannelId, ulong MessageId, ulong? GuildId, Emoji Emoji): IGatewayEvent;
|
@@ -1,15 +1,15 @@
|
||||
using Myriad.Types;
|
||||
using Myriad.Utils;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
namespace Myriad.Gateway;
|
||||
|
||||
public record MessageUpdateEvent(ulong Id, ulong ChannelId): IGatewayEvent
|
||||
{
|
||||
public record MessageUpdateEvent(ulong Id, ulong ChannelId): IGatewayEvent
|
||||
{
|
||||
public Optional<string?> Content { get; init; }
|
||||
public Optional<User> Author { get; init; }
|
||||
public Optional<GuildMemberPartial> Member { get; init; }
|
||||
public Optional<Message.Attachment[]> Attachments { get; init; }
|
||||
public Optional<ulong?> GuildId { get; init; }
|
||||
// TODO: lots of partials
|
||||
}
|
||||
public Optional<string?> Content { get; init; }
|
||||
public Optional<User> Author { get; init; }
|
||||
public Optional<GuildMemberPartial> Member { get; init; }
|
||||
public Optional<Message.Attachment[]> Attachments { get; init; }
|
||||
|
||||
public Optional<ulong?> GuildId { get; init; }
|
||||
// TODO: lots of partials
|
||||
}
|
@@ -2,14 +2,13 @@ using System.Text.Json.Serialization;
|
||||
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
namespace Myriad.Gateway;
|
||||
|
||||
public record ReadyEvent: IGatewayEvent
|
||||
{
|
||||
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; }
|
||||
}
|
||||
[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; }
|
||||
}
|
@@ -1,4 +1,3 @@
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record ResumedEvent: IGatewayEvent;
|
||||
}
|
||||
namespace Myriad.Gateway;
|
||||
|
||||
public record ResumedEvent: IGatewayEvent;
|
@@ -1,6 +1,5 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record ThreadCreateEvent: Channel, IGatewayEvent;
|
||||
}
|
||||
namespace Myriad.Gateway;
|
||||
|
||||
public record ThreadCreateEvent: Channel, IGatewayEvent;
|
@@ -1,12 +1,11 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
namespace Myriad.Gateway;
|
||||
|
||||
public record ThreadDeleteEvent: IGatewayEvent
|
||||
{
|
||||
public record ThreadDeleteEvent: IGatewayEvent
|
||||
{
|
||||
public ulong Id { get; init; }
|
||||
public ulong? GuildId { get; init; }
|
||||
public ulong? ParentId { get; init; }
|
||||
public Channel.ChannelType Type { get; init; }
|
||||
}
|
||||
public ulong Id { get; init; }
|
||||
public ulong? GuildId { get; init; }
|
||||
public ulong? ParentId { get; init; }
|
||||
public Channel.ChannelType Type { get; init; }
|
||||
}
|
@@ -1,11 +1,10 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
namespace Myriad.Gateway;
|
||||
|
||||
public record ThreadListSyncEvent: IGatewayEvent
|
||||
{
|
||||
public record ThreadListSyncEvent: IGatewayEvent
|
||||
{
|
||||
public ulong GuildId { get; init; }
|
||||
public ulong[]? ChannelIds { get; init; }
|
||||
public Channel[] Threads { get; init; }
|
||||
}
|
||||
public ulong GuildId { get; init; }
|
||||
public ulong[]? ChannelIds { get; init; }
|
||||
public Channel[] Threads { get; init; }
|
||||
}
|
@@ -1,6 +1,5 @@
|
||||
using Myriad.Types;
|
||||
|
||||
namespace Myriad.Gateway
|
||||
{
|
||||
public record ThreadUpdateEvent: Channel, IGatewayEvent;
|
||||
}
|
||||
namespace Myriad.Gateway;
|
||||
|
||||
public record ThreadUpdateEvent: Channel, IGatewayEvent;
|
Reference in New Issue
Block a user