From ec849e70558b9ad76e4189c4249e5a3bc07f085e Mon Sep 17 00:00:00 2001 From: Baptiste Parmantier Date: Thu, 26 Dec 2024 12:26:06 +0100 Subject: [PATCH 1/2] fix: member and role serializations --- .../commands/command_interaction_dispatcher.dart | 11 ++++++----- .../internals/datastore/parts/member_part.dart | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/src/domains/commands/command_interaction_dispatcher.dart b/lib/src/domains/commands/command_interaction_dispatcher.dart index 91fbee9d3..0cbe87271 100644 --- a/lib/src/domains/commands/command_interaction_dispatcher.dart +++ b/lib/src/domains/commands/command_interaction_dispatcher.dart @@ -81,15 +81,16 @@ final class CommandInteractionDispatcher options[Symbol(option['name'])] = switch (type) { CommandOptionType.user => switch (commandContext) { - ServerCommandContext() => await _dataStore.member.getMember( - serverId: commandContext.server.id, - memberId: option['value']), + ServerCommandContext() => await _dataStore.member + .getMember(serverId: commandContext.server.id, memberId: option['value']) + ..server = commandContext.server, _ => _marshaller.serializers.user.serialize(option['value']), }, CommandOptionType.channel => await _marshaller.serializers.channels.serialize(option['value']), - CommandOptionType.role => - await _marshaller.serializers.role.serialize(option['value']), + CommandOptionType.role => await _dataStore.role.getRole( + serverId: data['guild_id'], + roleId: option['value']), // TODO attachement _ => option['value'], }; diff --git a/lib/src/infrastructure/internals/datastore/parts/member_part.dart b/lib/src/infrastructure/internals/datastore/parts/member_part.dart index cbf8def7b..329295c9b 100644 --- a/lib/src/infrastructure/internals/datastore/parts/member_part.dart +++ b/lib/src/infrastructure/internals/datastore/parts/member_part.dart @@ -19,6 +19,7 @@ final class MemberPart implements MemberPartContract { @override Future getMember( {required Snowflake serverId, required Snowflake memberId}) async { + final cacheKeys = _marshaller.cacheKey; final memberCacheKey = cacheKeys.member(serverId, memberId); From 64e4ea6a0e77063bff566efa3d349b85981e781f Mon Sep 17 00:00:00 2001 From: Baptiste Parmantier Date: Thu, 26 Dec 2024 12:28:07 +0100 Subject: [PATCH 2/2] deploy: prepare deployment --- CHANGELOG.md | 4 ++++ pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac722433d..bbcf7793e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 4.0.0-dev.8 +- Fix `Member` option in commands +- Fix `Role` option in commands + # 4.0.0-dev.7 - Add missing `LogLevel` enum in exports - Fix parent channel as ServerChannel diff --git a/pubspec.yaml b/pubspec.yaml index 9899d34b9..3ab1ef8c1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: mineral description: Mineral is a Discord framework for designing discord bots in Dart. -version: 4.0.0-dev.7 +version: 4.0.0-dev.8 repository: https://github.com/mineral-dart/core # homepage: https://www.example.com