#Can't find the avatar_decoration property on my interactions.User() object

1 messages · Page 1 of 1 (latest)

high anvil
#

I've checked the interactions.User() class in user.py and its definitely there in the User() that inherits from BaseUser :

@attrs.define(eq=False, order=False, hash=False, kw_only=True)
class User(BaseUser):
...
banner: Optional["Asset"] = attrs.field(repr=False, default=None, metadata=docs("The user's banner"))
    
avatar_decoration: Optional["Asset"] = attrs.field(
        repr=False, default=None, metadata=docs("The user's avatar decoration"))

I'm fetching my User objects like so:

userList:list[interactions.User] = await Message.fetch_reaction(emoji = 🔥, limit=20)       

and iterating over each one to check if they have the avatar_decoration property

However when I do:

for user in userList:
  if user.avatar_decoration:
    do something

the avatar_decoration property is not found.

I'm using the latest version of i.py 5.6.0, I've tried uninstalling and reinstalling. but to no avail. Hope this is a detailed enough explanation.

night currentBOT
#

Hey! Once your issue is solved, press the button below to close this thread!

shadow cove
#

What's the error you get?

high anvil
# shadow cove What's the error you get?

Its not an error per se but it returns None. I just realised that if in actuality it wasn't implemented it would throw an AttributeError (I think?) and its also not in my list of attributes. is there a way I can fix this on my own?

gentle pawn
#

Oh, yeah, the intellisense hints don't include it yet. That's an easy fix

#

#1445 Adds the relevant stub.

night currentBOT
# gentle pawn #1445 Adds the relevant stub.

• Pull Request Type: Bugfix
• Created: <t:1686538367:R>

Description

It was raised that avatar_decoration wasn't in the stub file. This PR adds it, and a few other attributes that weren't stubbed.

Changes
  • Adds missing attribute stubs
  • Remove config line that prevents mypy from running in the repo
Test Scenarios

N/A

Python Compatibility
  • ✅ I've ensured my code works on Python 3.10.x
  • ❌ I've ensured my code works on Python 3.11.x
Checklist
  • ❌ I've run the pre-commit code linter over all edited files
  • ✅ I've tested my changes on supported Python versions
  • ❌ I've added tests for my code, if applicable
  • ❌ I've updated / added documentation, where applicable
gentle pawn
#

As you've noticed, it currently works, it just isn't appearing in VS Code's suggestions.