Skip to content

Commit

Permalink
hotfix: components parsing (#400)
Browse files Browse the repository at this point in the history
* hotfix: components parsing

* Update CHANGELOG.md

Co-authored-by: Szymon Uglis <[email protected]>

* Update CHANGELOG.md

Co-authored-by: Szymon Uglis <[email protected]>

* remove top NL

* Add version

Co-authored-by: Szymon Uglis <[email protected]>
  • Loading branch information
Lexedia and l7ssha authored Nov 15, 2022
1 parent a42d778 commit ce7ea8b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 4.2.1
__15.11.2022__

- hotfix: fix component deserialization failing when `customId` is `null`

## 4.2.0
__13.11.2022__

Expand Down
5 changes: 3 additions & 2 deletions lib/src/core/message/components/message_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ abstract class IMessageComponent {
/// The [ComponentType]
ComponentType get type;

/// The custom id of this component, set by the user.
/// The custom id of this component, set by the user, if there isn't one, an empty string is returned.
// TODO: Add nullable string in next major release.
String get customId;
}

Expand All @@ -113,7 +114,7 @@ abstract class MessageComponent implements IMessageComponent {
late final String customId;

MessageComponent(RawApiMap raw) {
customId = raw['custom_id'] as String;
customId = raw['custom_id'] as String? ?? '';
}

factory MessageComponent.deserialize(RawApiMap raw) {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/internal/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Constants {
static const int apiVersion = 10;

/// Version of Nyxx
static const String version = "4.2.0";
static const String version = "4.2.1";

/// Url to Nyxx repo
static const String repoUrl = "https://github.com/nyxx-discord/nyxx";
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: nyxx
version: 4.2.0
version: 4.2.1
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
Expand Down

0 comments on commit ce7ea8b

Please sign in to comment.