Repository: nyxx-discord/nyxx
Pull request #295 (2022-01-30 10:33:31)

Release 3.2.5


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e11e4200..9e37a39a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,9 @@
+## 3.2.5
+__30.01.2022__
+
+- bugfix: Serialization error with permissions on ChannelBuilder. Fixes #294
+- bugfix: Fix MemberBuilder serialization json error
+
 ## 3.2.4
 __23.01.2022__
 
diff --git a/lib/src/internal/constants.dart b/lib/src/internal/constants.dart
index 5900a710..56bbb7bc 100644
--- a/lib/src/internal/constants.dart
+++ b/lib/src/internal/constants.dart
@@ -33,7 +33,7 @@ class Constants {
   static const int apiVersion = 9;
 
   /// Version of Nyxx
-  static const String version = "3.2.4";
+  static const String version = "3.2.5";
 
   /// Url to Nyxx repo
   static const String repoUrl = "https://github.com/nyxx-discord/nyxx";
diff --git a/lib/src/utils/builders/channel_builder.dart b/lib/src/utils/builders/channel_builder.dart
index 8da0c051..2570d3f2 100644
--- a/lib/src/utils/builders/channel_builder.dart
+++ b/lib/src/utils/builders/channel_builder.dart
@@ -20,7 +20,7 @@ abstract class ChannelBuilder implements Builder {
         if (type != null) "type": type!.value,
         if (position != null) "position": position,
         if (parentChannel != null) "parent_id": parentChannel!.id.toString(),
-        if (permissionOverrides != null) "permission_overwrites": permissionOverrides!.map((e) => e.build()),
+        if (permissionOverrides != null) "permission_overwrites": permissionOverrides!.map((e) => e.build().build()).toList(),
       };
 }
 
diff --git a/lib/src/utils/builders/member_builder.dart b/lib/src/utils/builders/member_builder.dart
index b7a9c7bf..d89e0ea6 100644
--- a/lib/src/utils/builders/member_builder.dart
+++ b/lib/src/utils/builders/member_builder.dart
@@ -25,7 +25,7 @@ class MemberBuilder implements Builder {
         if (roles != null) 'roles': roles!.map((e) => e.toString()).toList(),
         if (mute != null) 'mute': mute,
         if (deaf != null) 'deaf': deaf,
-        if (channel != Snowflake.zero()) 'channel_id': channel,
+        if (channel != Snowflake.zero()) 'channel_id': channel.toString(),
         if (timeoutUntil?.millisecondsSinceEpoch != 0) 'communication_disabled_until': timeoutUntil?.toIso8601String(),
       };
 }
diff --git a/pubspec.yaml b/pubspec.yaml
index 2fd60aa8..7625f164 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
 name: nyxx
-version: 3.2.4
+version: 3.2.5
 description: A Discord library for Dart. Simple, robust framework for creating discord bots for Dart language.
 homepage: https://github.com/nyxx-discord/nyxx
 repository: https://github.com/nyxx-discord/nyxx


Test patch:
diff --git a/test/unit/builders_test.dart b/test/unit/builders_test.dart
index f08b73d0..037f17e7 100644
--- a/test/unit/builders_test.dart
+++ b/test/unit/builders_test.dart
@@ -41,6 +41,16 @@ main() {
     expect(cacheableBuilder.build(), equals({"message_id": '123', "fail_if_not_exists": true}));
   });
 
+  group("channel builder", () {
+    test('ChannelBuilder', () {
+      final builder = TextChannelBuilder.create("test");
+      builder.permissionOverrides = [PermissionOverrideBuilder.from(0, Snowflake.zero(), Permissions.empty())];
+
+      final expectedResult = {'permission_overwrites': [{'allow': 0, 'deny': 122406567679}], 'name': 'test'};
+      expect(builder.build(), expectedResult);
+    });
+  });
+
   group('presence_builder.dart', () {
     test('PresenceBuilder', () {
       final activityBuilder = ActivityBuilder.game("test game name");