#Detecting avatar change with on_user_update event
1 messages · Page 1 of 1 (latest)
Is the bot verified? If so, you need to apply for any intents that say "priveleged".
I'm having a bit of trouble with detecting user avatar changes. Changing the avatar definitely triggers the event, however before and after avatars are the same. Am I misunderstanding how that event works or is this just how the py-cord/ discord API works?
@commands.Cog.listener("on_member_update")
async def user_change(self, before: discord.Member, after: discord.Member):
...
if before.avatar != after.avatar:
change.title = "Avatar changed"
change.set_image(url=after.display_avatar.url)
change.colour = discord.Colour.orange()
...
Try printing out the Avatar urls and see if they're the same using avatar.url
They are, already tested it. It seems that before and after avatar are the same asset
Try enabling member intents
@frosty wharf
I have all intents
in the bot dev portal too?
In code?
Code would throw an error if it wasn't enabled in the portal
@frosty wharf
It looks like discord does not send the old data it is fetched from the cache. So if the user was not in cache it will not know the old state.
Hmm, that sucks. Any work arounds?
You could increases the cache i guess. But that takes up more memory.