Skip to content

Commit

Permalink
hotfix: Fix ratelimit handling (#435)
Browse files Browse the repository at this point in the history
* hotfix: Fix ratelimit handling

* changelog/4.4.1
  • Loading branch information
l7ssha authored Jan 22, 2023
1 parent 9ea12bc commit 80b0ac9
Show file tree
Hide file tree
Showing 4 changed files with 9 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.4.1
__22.01.2023__

- hotfix: Fix ratelimit handling

## 4.4.0
__12.12.2022__

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.4.0";
static const String version = "4.4.1";

/// Url to Nyxx repo
static const String repoUrl = "https://github.com/nyxx-discord/nyxx";
Expand Down
4 changes: 2 additions & 2 deletions lib/src/internal/http/http_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ class HttpHandler {
final responseError = await HttpResponseError.fromResponse(response);

// Check for 429, emit events and wait given in response body time
if (response.statusCode == 429) {
final responseBody = jsonDecode(await response.stream.bytesToString());
if (responseError.statusCode == 429) {
final responseBody = responseError.jsonBody;
final retryAfter = Duration(milliseconds: ((responseBody["retry_after"] as double) * 1000).ceil());
final isGlobal = responseBody["global"] as bool;

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.4.0
version: 4.4.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 80b0ac9

Please sign in to comment.