Skip to content

Commit

Permalink
feat(packets): make adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
LeadcodeDev committed Aug 21, 2024
1 parent bd42c39 commit 9880c9a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
10 changes: 10 additions & 0 deletions lib/api/common/channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,13 @@ abstract class Channel {
ChannelType get type;
T cast<T extends Channel>() => this as T;
}

final class UnknownChannel extends Channel {
@override
final Snowflake id;

@override
final ChannelType type = ChannelType.unknown;

UnknownChannel(this.id);
}
3 changes: 2 additions & 1 deletion lib/api/common/types/channel_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ enum ChannelType implements EnhancedEnum<int>{
guildStageVoice(13),
guildDirectory(14),
guildForum(15),
guildMedia(16);
guildMedia(16),
unknown(-1);

@override
final int value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<List<T>> getChannels<T extends ServerChannel>(Snowflake id) async {
Expand Down

0 comments on commit 9880c9a

Please sign in to comment.