From 9880c9ae7aa79f977007ef126bc4889c104d70d4 Mon Sep 17 00:00:00 2001 From: Baptiste Parmantier Date: Thu, 22 Aug 2024 00:36:19 +0200 Subject: [PATCH] feat(packets): make adjustments --- lib/api/common/channel.dart | 10 ++++++++++ lib/api/common/types/channel_type.dart | 3 ++- .../internals/datastore/parts/server_part.dart | 3 ++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/api/common/channel.dart b/lib/api/common/channel.dart index 20ad80a9..47309d84 100644 --- a/lib/api/common/channel.dart +++ b/lib/api/common/channel.dart @@ -6,3 +6,13 @@ abstract class Channel { ChannelType get type; T cast() => this as T; } + +final class UnknownChannel extends Channel { + @override + final Snowflake id; + + @override + final ChannelType type = ChannelType.unknown; + + UnknownChannel(this.id); +} diff --git a/lib/api/common/types/channel_type.dart b/lib/api/common/types/channel_type.dart index 5fbb92e3..d997dd63 100644 --- a/lib/api/common/types/channel_type.dart +++ b/lib/api/common/types/channel_type.dart @@ -13,7 +13,8 @@ enum ChannelType implements EnhancedEnum{ guildStageVoice(13), guildDirectory(14), guildForum(15), - guildMedia(16); + guildMedia(16), + unknown(-1); @override final int value; diff --git a/lib/infrastructure/internals/datastore/parts/server_part.dart b/lib/infrastructure/internals/datastore/parts/server_part.dart index 386fadb5..62499349 100644 --- a/lib/infrastructure/internals/datastore/parts/server_part.dart +++ b/lib/infrastructure/internals/datastore/parts/server_part.dart @@ -30,7 +30,8 @@ final class ServerPart implements DataStorePart { await getChannels(id); await _kernel.dataStore.member.getMembers(id); - return _kernel.marshaller.serializers.server.serialize(serverResponse.body); + final payload = await _kernel.marshaller.serializers.server.normalize(serverResponse.body); + return _kernel.marshaller.serializers.server.serialize(payload); } Future> getChannels(Snowflake id) async {