pycord icon indicating copy to clipboard operation
pycord copied to clipboard

on_member_update only works with members in cache

Open Miolus opened this issue 4 years ago • 4 comments

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

Miolus avatar Jan 06 '22 10:01 Miolus

This event requires member intents as stated in the docs.

zeffo avatar Jan 06 '22 11:01 zeffo

This event requires member intents as stated in the docs.

Yes. This intent was enabled when trying to produce the bug.

Miolus avatar Jan 06 '22 13:01 Miolus

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.

Miolus avatar Jan 08 '22 08:01 Miolus

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.

The docs could still be modified to mention that this is the case

plun1331 avatar Jan 08 '22 17:01 plun1331