From d401d6d149c98f0db43bdd9f3ae6861d06cf6058 Mon Sep 17 00:00:00 2001 From: Dolfies Date: Thu, 2 Jan 2025 18:44:38 -0500 Subject: [PATCH] Remove dead get user named endpoint --- discord/client.py | 63 ----------------------------------------------- discord/http.py | 6 ----- 2 files changed, 69 deletions(-) diff --git a/discord/client.py b/discord/client.py index ede7888c6..85c0aedea 100644 --- a/discord/client.py +++ b/discord/client.py @@ -2423,69 +2423,6 @@ class Client: data = await self.http.get_user(user_id) return User(state=self._connection, data=data) - @overload - async def fetch_user_named(self, user: str, /) -> User: - ... - - @overload - async def fetch_user_named(self, username: str, discriminator: str, /) -> User: - ... - - async def fetch_user_named(self, *args: str) -> User: - """|coro| - - Retrieves a :class:`discord.User` based on their name or legacy username. - You do not have to share any guilds with the user to get this information, - however you must be able to add them as a friend. - - This function can be used in multiple ways. - - .. versionadded:: 2.1 - - .. code-block:: python - - # Passing a username - await client.fetch_user_named('jake') - - # Passing a legacy user: - await client.fetch_user_named('Jake#0001') - - # Passing a legacy username and discriminator: - await client.fetch_user_named('Jake', '0001') - - Parameters - ----------- - user: :class:`str` - The user to send the friend request to. - username: :class:`str` - The username of the user to send the friend request to. - discriminator: :class:`str` - The discriminator of the user to send the friend request to. - - Raises - ------- - Forbidden - Not allowed to send a friend request to this user. - HTTPException - Fetching the user failed. - TypeError - More than 2 parameters or less than 1 parameter was passed. - - Returns - -------- - :class:`discord.User` - The user you requested. - """ - if len(args) == 1: - username, _, discrim = args[0].partition('#') - elif len(args) == 2: - username, discrim = args - else: - raise TypeError(f'fetch_user_named() takes 1 or 2 arguments but {len(args)} were given') - - data = await self.http.get_user_named(username, discrim) - return User(state=self._connection, data=data) - async def fetch_user_profile( self, user_id: int, diff --git a/discord/http.py b/discord/http.py index fcc193ad9..91e6f9b1d 100644 --- a/discord/http.py +++ b/discord/http.py @@ -4381,12 +4381,6 @@ class HTTPClient: def get_user(self, user_id: Snowflake) -> Response[user.APIUser]: return self.request(Route('GET', '/users/{user_id}', user_id=user_id)) - def get_user_named(self, username: str, dicriminator: Optional[str] = None) -> Response[user.APIUser]: - params = {} - if dicriminator: - params['discriminator'] = dicriminator - return self.request(Route('GET', '/users/username/{username}', username=username), params=params) - def get_user_profile( self, user_id: Snowflake,