Browse Source

Update FriendSuggestionReason types

pull/10109/head
dolfies 2 years ago
parent
commit
8f3e334daa
  1. 2
      discord/enums.py
  2. 8
      discord/relationship.py
  3. 2
      discord/types/user.py

2
discord/enums.py

@ -439,7 +439,7 @@ class RelationshipType(Enum):
incoming_request = 3
outgoing_request = 4
implicit = 5
suggestion = 6
suggestion = 6 # Unused
class NotificationLevel(Enum, comparable=True):

8
discord/relationship.py

@ -338,18 +338,18 @@ class FriendSuggestionReason:
-----------
platform: :class:`ConnectionType`
The platform the user was suggested from.
name: :class:`str`
name: Optional[:class:`str`]
The user's name on the platform.
"""
__slots__ = ('type', 'platform', 'name')
def __init__(self, data: FriendSuggestionReasonPayload):
# This entire model is unused by any client, so I have no idea what the type is
# This entire model is mostly unused by any client, so I have no idea what the type is
# Also because of this, I'm treating everything as optional just in case
self.type: int = data.get('type', 0)
self.platform: ConnectionType = try_enum(ConnectionType, data.get('platform', 'contacts'))
self.name: str = data.get('name', '')
self.platform: ConnectionType = try_enum(ConnectionType, data.get('platform'))
self.name: Optional[str] = data.get('name')
def __repr__(self) -> str:
return f'<FriendSuggestionReason platform={self.platform!r} name={self.name!r}>'

2
discord/types/user.py

@ -159,7 +159,7 @@ class Note(TypedDict):
class FriendSuggestionReason(TypedDict):
name: str
name: Optional[str]
platform_type: ConnectionType
type: int

Loading…
Cancel
Save