Skip to content

Commit

Permalink
Fix parsing members received in interaction resolved_data
Browse files Browse the repository at this point in the history
  • Loading branch information
abitofevrything committed Aug 26, 2023
1 parent 0108748 commit b516ef5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions lib/src/http/managers/interaction_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,12 @@ class InteractionManager {
),
members: maybeParse(
raw['members'],
(Map<String, Object?> raw) =>
raw.map((key, value) => MapEntry(Snowflake.parse(key), client.guilds[guildId ?? Snowflake.zero].members.parse(value as Map<String, Object?>))),
(Map<String, Object?> raw) => raw.map(
(key, value) => MapEntry(
Snowflake.parse(key),
client.guilds[guildId ?? Snowflake.zero].members.parse(value as Map<String, Object?>, userId: Snowflake.parse(key)),
),
),
),
roles: maybeParse(
raw['roles'],
Expand Down
4 changes: 2 additions & 2 deletions lib/src/http/managers/member_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class MemberManager extends Manager<Member> {
PartialMember operator [](Snowflake id) => PartialMember(id: id, manager: this);

@override
Member parse(Map<String, Object?> raw) {
Member parse(Map<String, Object?> raw, {Snowflake? userId}) {
return Member(
id: Snowflake.parse((raw['user'] as Map<String, Object?>)['id']!),
id: userId ?? Snowflake.parse((raw['user'] as Map<String, Object?>)['id']!),
manager: this,
user: maybeParse(raw['user'], client.users.parse),
nick: raw['nick'] as String?,
Expand Down

0 comments on commit b516ef5

Please sign in to comment.