Repository: Rapptz/discord.py

Issue:
public_flags.all() doesn't return updated badges.
## Summary

Doing discord.Member.public_flags.all() doesn't return updated badge list unless the bot's reran.

## Reproduction Steps

Command made in a cog that prints the current list of public badges/flags of a member. 

Here's the source code for the current command:

```py
@commands.command()
async def test(self, ctx: commands.Context):
    print(ctx.author.public_flags.all())
```
Be aware that this is in a cog and it's an AutoShardedBot.

## Expected Results

I was expecting the command to print an updated list of badges. I printed all the badges I had (HypeSquad House), this printed the current one I had. I changed the hypesquad houses from the settings and ran the command again. **I expected the house to change**

## Actual Results

To my surprise, it didn't. **It printed the ones I had before and not the updated house**. I reran the bot and invoked the command, and it printed the updated one. There were no errors.

## Intents

I have these intents turned on in the source code:

```py
discord.Intents(messages=True, guilds=True, members=True,
                webhooks=False, invites=True, presences=True,
                reactions=True, typing=True)
```

And these in the dev portal:

![Discord dev portal intents](https://i.imgur.com/RhoU2ya.png)

## Checklist

<!-- Put an x inside [ ] to check it, like so: [x] -->

- [x] I have searched the open issues for duplicates.
- [x] I have shown the entire traceback, if possible.
- [x] I have removed my token from display, if visible.
- [x] I have provided the intents that my bot is using.
> [x] I have searched the open issues for duplicates.

I managed to find the a similar (but not exact) problem but with Roles instead. [Here's that](https://github.com/Rapptz/discord.py/issues/6262)

## System Info

```md
- Python v3.8.6-final
- discord.py v1.6.0-final
- aiohttp v3.6.3
- system info: Windows 10 10.0.18362
```



Discussion:

Resolving patch:
diff --git a/discord/member.py b/discord/member.py
--- a/discord/member.py
+++ b/discord/member.py
@@ -290,12 +290,12 @@ def _presence_update(self, data, user):
 
     def _update_inner_user(self, user):
         u = self._user
-        original = (u.name, u.avatar, u.discriminator)
+        original = (u.name, u.avatar, u.discriminator, u._public_flags)
         # These keys seem to always be available
-        modified = (user['username'], user['avatar'], user['discriminator'])
+        modified = (user['username'], user['avatar'], user['discriminator'], user.get('public_flags', 0))
         if original != modified:
             to_return = User._copy(self._user)
-            u.name, u.avatar, u.discriminator = modified
+            u.name, u.avatar, u.discriminator, u._public_flags = modified
             # Signal to dispatch on_user_update
             return to_return, u
 
diff --git a/discord/user.py b/discord/user.py
--- a/discord/user.py
+++ b/discord/user.py
@@ -120,6 +120,7 @@ def _copy(cls, user):
         self.avatar = user.avatar
         self.bot = user.bot
         self._state = user._state
+        self._public_flags = user._public_flags
 
         return self
 


Test patch: