|
@ -2431,14 +2431,15 @@ class Client: |
|
|
with_mutual_guilds: bool = True, |
|
|
with_mutual_guilds: bool = True, |
|
|
with_mutual_friends_count: bool = False, |
|
|
with_mutual_friends_count: bool = False, |
|
|
with_mutual_friends: bool = True, |
|
|
with_mutual_friends: bool = True, |
|
|
|
|
|
friend_token: str = MISSING, |
|
|
) -> UserProfile: |
|
|
) -> UserProfile: |
|
|
"""|coro| |
|
|
"""|coro| |
|
|
|
|
|
|
|
|
Retrieves a :class:`.UserProfile` based on their user ID. |
|
|
Retrieves a :class:`.UserProfile` based on their user ID. |
|
|
|
|
|
|
|
|
You must share a guild, be friends with this user, |
|
|
You must provide a valid ``friend_token``, share a guild with, |
|
|
or have an incoming friend request from them to |
|
|
be friends with, or have an incoming friend request from this |
|
|
get this information (unless the user is a bot). |
|
|
user to get this information, unless the user is a bot. |
|
|
|
|
|
|
|
|
.. versionchanged:: 2.0 |
|
|
.. versionchanged:: 2.0 |
|
|
|
|
|
|
|
@ -2463,13 +2464,16 @@ class Client: |
|
|
This fills in :attr:`.UserProfile.mutual_friends` and :attr:`.UserProfile.mutual_friends_count`. |
|
|
This fills in :attr:`.UserProfile.mutual_friends` and :attr:`.UserProfile.mutual_friends_count`. |
|
|
|
|
|
|
|
|
.. versionadded:: 2.0 |
|
|
.. versionadded:: 2.0 |
|
|
|
|
|
friend_token: :class:`str` |
|
|
|
|
|
The friend token to use for fetching the profile. |
|
|
|
|
|
|
|
|
|
|
|
.. versionadded:: 2.1 |
|
|
|
|
|
|
|
|
Raises |
|
|
Raises |
|
|
------- |
|
|
------- |
|
|
NotFound |
|
|
NotFound |
|
|
A user with this ID does not exist. |
|
|
A user with this ID does not exist. |
|
|
Forbidden |
|
|
You do not have a mutual with this user and the user is not a bot. |
|
|
You do not have a mutual with this user, and the user is not a bot. |
|
|
|
|
|
HTTPException |
|
|
HTTPException |
|
|
Fetching the profile failed. |
|
|
Fetching the profile failed. |
|
|
|
|
|
|
|
@ -2484,6 +2488,7 @@ class Client: |
|
|
with_mutual_guilds=with_mutual_guilds, |
|
|
with_mutual_guilds=with_mutual_guilds, |
|
|
with_mutual_friends_count=with_mutual_friends_count, |
|
|
with_mutual_friends_count=with_mutual_friends_count, |
|
|
with_mutual_friends=with_mutual_friends, |
|
|
with_mutual_friends=with_mutual_friends, |
|
|
|
|
|
friend_token=friend_token or None, |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
return UserProfile(state=state, data=data) |
|
|
return UserProfile(state=state, data=data) |
|
@ -3020,6 +3025,32 @@ class Client: |
|
|
data = await state.http.get_friend_suggestions() |
|
|
data = await state.http.get_friend_suggestions() |
|
|
return [FriendSuggestion(state=state, data=d) for d in data] |
|
|
return [FriendSuggestion(state=state, data=d) for d in data] |
|
|
|
|
|
|
|
|
|
|
|
async def friend_token(self) -> str: |
|
|
|
|
|
"""|coro| |
|
|
|
|
|
|
|
|
|
|
|
Retrieves your friend token. |
|
|
|
|
|
|
|
|
|
|
|
These can be used to fetch the user's profile without a mutual |
|
|
|
|
|
and add the user as a friend regardless of their friend request settings. |
|
|
|
|
|
|
|
|
|
|
|
To share, append it to the user's URL like so: |
|
|
|
|
|
``https://discord.com/users/{user.id}?friend_token={friend_token}``. |
|
|
|
|
|
|
|
|
|
|
|
.. versionadded:: 2.1 |
|
|
|
|
|
|
|
|
|
|
|
Raises |
|
|
|
|
|
------- |
|
|
|
|
|
HTTPException |
|
|
|
|
|
Retrieving your friend token failed. |
|
|
|
|
|
|
|
|
|
|
|
Returns |
|
|
|
|
|
-------- |
|
|
|
|
|
:class:`str` |
|
|
|
|
|
Your friend token. |
|
|
|
|
|
""" |
|
|
|
|
|
data = await self.http.get_friend_token() |
|
|
|
|
|
return data['friend_token'] |
|
|
|
|
|
|
|
|
async def fetch_country_code(self) -> str: |
|
|
async def fetch_country_code(self) -> str: |
|
|
"""|coro| |
|
|
"""|coro| |
|
|
|
|
|
|
|
|