Skip to content

Commit

Permalink
Merge pull request #474 from nyxx-discord/hotfix/guild-caches-uniniti…
Browse files Browse the repository at this point in the history
…alised

Initialise guild caches even when guild is not from a create event
  • Loading branch information
l7ssha authored Apr 11, 2023
2 parents af75377 + 3ec76d8 commit 20f0a7b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 5.0.3
__11.04.2023__

- bug: Always initialize guild caches

## 5.0.2
__08.04.2023__

Expand Down
6 changes: 3 additions & 3 deletions lib/src/core/guild/guild.dart
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,9 @@ class Guild extends SnowflakeEntity implements IGuild {
for (final rawSticker in raw["stickers"] as RawApiList) GuildSticker(rawSticker as RawApiMap, client)
];

autoModerationRules = SnowflakeCache<IAutoModerationRule>();
scheduledEvents = SnowflakeCache<IGuildEvent>();

if (!guildCreate) return;

raw["channels"].forEach((o) {
Expand Down Expand Up @@ -722,9 +725,6 @@ class Guild extends SnowflakeEntity implements IGuild {
if (raw["stage_instances"] != null)
for (final rawInstance in raw["stage_instances"] as RawApiList) StageChannelInstance(client, rawInstance as RawApiMap)
];

autoModerationRules = SnowflakeCache<IAutoModerationRule>();
scheduledEvents = SnowflakeCache<IGuildEvent>();
}

/// The guild's icon, represented as URL.
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 = "5.0.2";
static const String version = "5.0.3";

/// 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: 5.0.2
version: 5.0.3
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 20f0a7b

Please sign in to comment.