#Detecting avatar change with on_user_update event

1 messages · Page 1 of 1 (latest)

sinful wharf
meager sage
#

Is the bot verified? If so, you need to apply for any intents that say "priveleged".

frosty wharf
#

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()

         ...
hearty wadi
frosty wharf
#

They are, already tested it. It seems that before and after avatar are the same asset

hearty wadi
#

Try enabling member intents

hearty wadi
frosty wharf
#

I have all intents

robust flint
#

in the bot dev portal too?

hearty wadi
#

In code?

hearty wadi
hearty wadi
frosty wharf
#

Yup, everything enabled since I don't plan on going public with it

#

@hearty wadi

grave ginkgo
#

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.

frosty wharf
grave ginkgo
#

You could increases the cache i guess. But that takes up more memory.