on_member_update only works with members in cache
Summary
on_member_update won't be triggered when the member is not in the cache.
Reproduction Steps
Create a client with discord.MemberCacheFlags.none(), try to use on_member_update, it will only work for the client itsself as it's the only member object in cache.
Minimal Reproducible Code
bot = commands.AutoShardedBot(member_cache_flags=discord.MemberCacheFlags.none())
@bot.event
async def on_member_update(before, after):
...
bot.run("token")
Expected Results
Trigger on_member_update for every member update action.
Actual Results
The event only gets triggered on actions with the client's member object.
Intents
members
System Information
python3.9 pycord alpha
Checklist
- [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.
Additional Context
No response
This event requires member intents as stated in the docs.
This event requires member intents as stated in the docs.
Yes. This intent was enabled when trying to produce the bug.
Turns out having all members in cache is necessary to return the before member object in the event, as this ain't sent by the discord API.
Turns out having all members in cache is necessary to return the
beforemember object in the event, as this ain't sent by the discord API.
The docs could still be modified to mention that this is the case