Add positional-only arguments in more places

This commit is contained in:
jack1142
2022-02-20 02:28:01 +01:00
committed by GitHub
parent 19b10eecfe
commit dc19c6c7d5
14 changed files with 202 additions and 23 deletions

View File

@@ -741,6 +741,10 @@ class Client:
def get_channel(self, id: int, /) -> Optional[Union[GuildChannel, Thread, PrivateChannel]]:
"""Returns a channel or thread with the given ID.
.. versionchanged:: 2.0
``id`` parameter is now positional-only.
Parameters
-----------
id: :class:`int`
@@ -800,6 +804,10 @@ class Client:
def get_guild(self, id: int, /) -> Optional[Guild]:
"""Returns a guild with the given ID.
.. versionchanged:: 2.0
``id`` parameter is now positional-only.
Parameters
-----------
id: :class:`int`
@@ -815,6 +823,10 @@ class Client:
def get_user(self, id: int, /) -> Optional[User]:
"""Returns a user with the given ID.
.. versionchanged:: 2.0
``id`` parameter is now positional-only.
Parameters
-----------
id: :class:`int`
@@ -830,6 +842,10 @@ class Client:
def get_emoji(self, id: int, /) -> Optional[Emoji]:
"""Returns an emoji with the given ID.
.. versionchanged:: 2.0
``id`` parameter is now positional-only.
Parameters
-----------
id: :class:`int`
@@ -1205,6 +1221,10 @@ class Client:
This method is an API call. For general usage, consider :meth:`get_guild` instead.
.. versionchanged:: 2.0
``guild_id`` parameter is now positional-only.
Parameters
-----------
guild_id: :class:`int`
@@ -1239,6 +1259,10 @@ class Client:
Bot accounts in more than 10 guilds are not allowed to create guilds.
.. versionchanged:: 2.0
``name`` and ``region``, and ``icon`` parameters are now keyword-only.
Parameters
----------
name: :class:`str`
@@ -1352,7 +1376,7 @@ class Client:
data = await self.http.get_invite(invite_id, with_counts=with_counts, with_expiration=with_expiration)
return Invite.from_incomplete(state=self._connection, data=data)
async def delete_invite(self, invite: Union[Invite, str]) -> None:
async def delete_invite(self, invite: Union[Invite, str], /) -> None:
"""|coro|
Revokes an :class:`.Invite`, URL, or ID to an invite.
@@ -1360,6 +1384,10 @@ class Client:
You must have the :attr:`~.Permissions.manage_channels` permission in
the associated guild to do this.
.. versionchanged:: 2.0
``invite`` parameter is now positional-only.
Parameters
----------
invite: Union[:class:`.Invite`, :class:`str`]
@@ -1389,6 +1417,10 @@ class Client:
The guild must have the widget enabled to get this information.
.. versionchanged:: 2.0
``guild_id`` parameter is now positional-only.
Parameters
-----------
guild_id: :class:`int`
@@ -1441,6 +1473,10 @@ class Client:
This method is an API call. If you have :attr:`discord.Intents.members` and member cache enabled, consider :meth:`get_user` instead.
.. versionchanged:: 2.0
``user_id`` parameter is now positional-only.
Parameters
-----------
user_id: :class:`int`
@@ -1472,6 +1508,10 @@ class Client:
.. versionadded:: 1.2
.. versionchanged:: 2.0
``channel_id`` parameter is now positional-only.
Raises
-------
:exc:`.InvalidData`
@@ -1511,6 +1551,10 @@ class Client:
Retrieves a :class:`.Webhook` with the specified ID.
.. versionchanged:: 2.0
``webhook_id`` parameter is now positional-only.
Raises
--------
:exc:`.HTTPException`