diff --git a/CHANGELOG.md b/CHANGELOG.md index 296bfbd9e..016acf7bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## 3.0.1 +__21.12.2021__ + +- Fix CliItegration plugin not working with IgnoreExceptions (#256) +- Use logger instead of print (#259) +- Fix typo in file name (#260) +- Nullable close code (#261) +- Missing ActivityBuilder (#262) + ## 3.0.0 __19.12.2021__ @@ -16,6 +25,7 @@ __19.12.2021__ > Previously similar behavior was available but wasn't working as intended. - Implemented ITextVoiceTextChannel. > Discords beta feature `chat in voice channels` was implemented in form of `ITextVoiceTextChannel` interface +- Added support for Guild Scheduled Events - Do not send auth header when it's not needed - Added support for Dart 2.15 - Fixup message update payload deserialization diff --git a/lib/nyxx.dart b/lib/nyxx.dart index eb4c6dfc7..dfab87bec 100644 --- a/lib/nyxx.dart +++ b/lib/nyxx.dart @@ -157,7 +157,7 @@ export 'src/utils/builders/guild_builder.dart' show GuildBuilder, RoleBuilder; export 'src/utils/builders/channel_builder.dart'; export 'src/utils/builders/message_builder.dart' show MessageBuilder, MessageDecoration; export 'src/utils/builders/permissions_builder.dart' show PermissionOverrideBuilder, PermissionsBuilder; -export 'src/utils/builders/presence_builder.dart' show PresenceBuilder; +export 'src/utils/builders/presence_builder.dart' show PresenceBuilder, ActivityBuilder; export 'src/utils/builders/reply_builder.dart' show ReplyBuilder; export 'src/utils/builders/sticker_builder.dart' show StickerBuilder; export 'src/utils/builders/thread_builder.dart' show ThreadArchiveTime, ThreadBuilder; @@ -167,7 +167,7 @@ export 'src/utils/permissions.dart' show PermissionsUtils; export 'src/utils/utils.dart' show ListSafeFirstWhere; export 'src/plugin/plugin.dart' show BasePlugin; -export 'src/plugin/plugin_manger.dart' show IPluginManager; +export 'src/plugin/plugin_manager.dart' show IPluginManager; export 'src/plugin/plugins/cli_integration.dart' show CliIntegration; export 'src/plugin/plugins/ignore_exception.dart' show IgnoreExceptions; export 'src/plugin/plugins/logging.dart' show Logging; diff --git a/lib/src/internal/constants.dart b/lib/src/internal/constants.dart index 531549eb9..e451b7b4c 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.0.0"; + static const String version = "3.0.1"; /// Url to Nyxx repo static const String repoUrl = "https://github.com/nyxx-discord/nyxx"; diff --git a/lib/src/internal/shard/shard.dart b/lib/src/internal/shard/shard.dart index 1ccf6c98c..a3a9069e0 100644 --- a/lib/src/internal/shard/shard.dart +++ b/lib/src/internal/shard/shard.dart @@ -226,7 +226,12 @@ class Shard implements IShard { } void _handleError(dynamic data) { - final closeCode = data["errorCode"] as int; + final closeCode = data["errorCode"] as int?; + + if (closeCode == null) { + manager.logger.warning("Received null close = client is probably closing. Payload: `$data`"); + return; + } _connected = false; _heartbeatTimer.cancel(); @@ -528,7 +533,7 @@ class Shard implements IShard { if (manager.connectionManager.client.options.dispatchRawShardEvent) { manager.onRawEventController.add(RawEvent(this, rawPayload)); } else { - print("UNKNOWN OPCODE: $rawPayload"); + manager.logger.info("UNKNOWN OPCODE: $rawPayload"); } } break; diff --git a/lib/src/plugin/plugin_manger.dart b/lib/src/plugin/plugin_manager.dart similarity index 100% rename from lib/src/plugin/plugin_manger.dart rename to lib/src/plugin/plugin_manager.dart diff --git a/lib/src/plugin/plugins/ignore_exception.dart b/lib/src/plugin/plugins/ignore_exception.dart index 82fc077d4..62a77c721 100644 --- a/lib/src/plugin/plugins/ignore_exception.dart +++ b/lib/src/plugin/plugins/ignore_exception.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:io'; import 'dart:isolate'; import 'package:logging/logging.dart'; @@ -15,6 +16,10 @@ class IgnoreExceptions extends BasePlugin { final stackTrace = err[1] != null ? ". Stacktrace: \n${err[1]}" : ""; logger.shout("Got Error: Message: [${err[0]}]$stackTrace"); + + if (err[0].startsWith('UnrecoverableNyxxError') as bool) { + Isolate.current.kill(); + } }); Isolate.current.addErrorListener(errorsPort.sendPort); diff --git a/pubspec.yaml b/pubspec.yaml index 900ccb7cc..5e6d56768 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: nyxx -version: 3.0.0 +version: 3.0.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