Skip to content

Commit

Permalink
fix: handle public_flags value for Message.author when member cac…
Browse files Browse the repository at this point in the history
…he is disabled (#870)

The `Message.__init__ -> Message._handle_member -> Member._from_message`
path calls `User._to_minimal_user_json`, which previously didn't copy
over the user's `public_flags` value.
With the member cache (and therefore also the user cache) enabled, this
isn't an issue as `Member.__init__` uses the cached user and not the
(previously incomplete) user data. With the cache disabled, the user
data gets parsed, which didn't include that value.

To reproduce, just `print(ctx.author.public_flags)`.

Co-authored-by: arl <[email protected]>
Signed-off-by: arl <[email protected]>
  • Loading branch information
shiftinv and onerandomusername committed Feb 5, 2023
1 parent e20e8ce commit 39ea73e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog/870.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix :attr:`Message.author.public_flags <Member.public_flags>` always being ``0`` when the member cache is disabled.
1 change: 1 addition & 0 deletions disnake/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def _to_minimal_user_json(self) -> UserPayload:
"avatar": self._avatar,
"discriminator": self.discriminator,
"bot": self.bot,
"public_flags": self._public_flags,
}

@property
Expand Down

0 comments on commit 39ea73e

Please sign in to comment.