Browse Source

Add positional-only arguments in more places

pull/7494/head
jack1142 3 years ago
committed by GitHub
parent
commit
dc19c6c7d5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      discord/abc.py
  2. 26
      discord/channel.py
  3. 46
      discord/client.py
  4. 30
      discord/ext/commands/bot.py
  5. 4
      discord/ext/commands/context.py
  6. 30
      discord/ext/commands/core.py
  7. 12
      discord/ext/commands/help.py
  8. 32
      discord/guild.py
  9. 6
      discord/message.py
  10. 4
      discord/reaction.py
  11. 15
      discord/shard.py
  12. 6
      discord/threads.py
  13. 5
      discord/utils.py
  14. 6
      discord/webhook/async_.py

3
discord/abc.py

@ -546,6 +546,9 @@ class GuildChannel:
.. versionchanged:: 2.0 .. versionchanged:: 2.0
The object passed in can now be a role object. The object passed in can now be a role object.
.. versionchanged:: 2.0
``obj`` parameter is now positional-only.
Parameters Parameters
---------- ----------
obj: Union[:class:`~discord.Member`, :class:`~discord.Role`] obj: Union[:class:`~discord.Member`, :class:`~discord.Role`]

26
discord/channel.py

@ -360,7 +360,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
{'topic': self.topic, 'nsfw': self.nsfw, 'rate_limit_per_user': self.slowmode_delay}, name=name, reason=reason {'topic': self.topic, 'nsfw': self.nsfw, 'rate_limit_per_user': self.slowmode_delay}, name=name, reason=reason
) )
async def delete_messages(self, messages: Iterable[Snowflake]) -> None: async def delete_messages(self, messages: Iterable[Snowflake], /) -> None:
"""|coro| """|coro|
Deletes a list of messages. This is similar to :meth:`Message.delete` Deletes a list of messages. This is similar to :meth:`Message.delete`
@ -376,6 +376,10 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
You must have the :attr:`~Permissions.manage_messages` permission to You must have the :attr:`~Permissions.manage_messages` permission to
use this. use this.
.. versionchanged:: 2.0
``messages`` parameter is now positional-only.
Parameters Parameters
----------- -----------
messages: Iterable[:class:`abc.Snowflake`] messages: Iterable[:class:`abc.Snowflake`]
@ -639,6 +643,10 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
.. versionadded:: 1.6 .. versionadded:: 1.6
.. versionchanged:: 2.0
``message_id`` parameter is now positional-only.
Parameters Parameters
------------ ------------
message_id: :class:`int` message_id: :class:`int`
@ -1796,6 +1804,10 @@ class DMChannel(discord.abc.Messageable, Hashable):
- :attr:`~Permissions.send_tts_messages`: You cannot send TTS messages in a DM. - :attr:`~Permissions.send_tts_messages`: You cannot send TTS messages in a DM.
- :attr:`~Permissions.manage_messages`: You cannot delete others messages in a DM. - :attr:`~Permissions.manage_messages`: You cannot delete others messages in a DM.
.. versionchanged:: 2.0
``obj`` parameter is now positional-only.
Parameters Parameters
----------- -----------
obj: :class:`User` obj: :class:`User`
@ -1822,6 +1834,10 @@ class DMChannel(discord.abc.Messageable, Hashable):
.. versionadded:: 1.6 .. versionadded:: 1.6
.. versionchanged:: 2.0
``message_id`` parameter is now positional-only.
Parameters Parameters
------------ ------------
message_id: :class:`int` message_id: :class:`int`
@ -1943,6 +1959,10 @@ class GroupChannel(discord.abc.Messageable, Hashable):
This also checks the kick_members permission if the user is the owner. This also checks the kick_members permission if the user is the owner.
.. versionchanged:: 2.0
``obj`` parameter is now positional-only.
Parameters Parameters
----------- -----------
obj: :class:`~discord.abc.Snowflake` obj: :class:`~discord.abc.Snowflake`
@ -2028,6 +2048,10 @@ class PartialMessageable(discord.abc.Messageable, Hashable):
This is useful if you want to work with a message and only have its ID without This is useful if you want to work with a message and only have its ID without
doing an unnecessary API call. doing an unnecessary API call.
.. versionchanged:: 2.0
``message_id`` parameter is now positional-only.
Parameters Parameters
------------ ------------
message_id: :class:`int` message_id: :class:`int`

46
discord/client.py

@ -741,6 +741,10 @@ class Client:
def get_channel(self, id: int, /) -> Optional[Union[GuildChannel, Thread, PrivateChannel]]: def get_channel(self, id: int, /) -> Optional[Union[GuildChannel, Thread, PrivateChannel]]:
"""Returns a channel or thread with the given ID. """Returns a channel or thread with the given ID.
.. versionchanged:: 2.0
``id`` parameter is now positional-only.
Parameters Parameters
----------- -----------
id: :class:`int` id: :class:`int`
@ -800,6 +804,10 @@ class Client:
def get_guild(self, id: int, /) -> Optional[Guild]: def get_guild(self, id: int, /) -> Optional[Guild]:
"""Returns a guild with the given ID. """Returns a guild with the given ID.
.. versionchanged:: 2.0
``id`` parameter is now positional-only.
Parameters Parameters
----------- -----------
id: :class:`int` id: :class:`int`
@ -815,6 +823,10 @@ class Client:
def get_user(self, id: int, /) -> Optional[User]: def get_user(self, id: int, /) -> Optional[User]:
"""Returns a user with the given ID. """Returns a user with the given ID.
.. versionchanged:: 2.0
``id`` parameter is now positional-only.
Parameters Parameters
----------- -----------
id: :class:`int` id: :class:`int`
@ -830,6 +842,10 @@ class Client:
def get_emoji(self, id: int, /) -> Optional[Emoji]: def get_emoji(self, id: int, /) -> Optional[Emoji]:
"""Returns an emoji with the given ID. """Returns an emoji with the given ID.
.. versionchanged:: 2.0
``id`` parameter is now positional-only.
Parameters Parameters
----------- -----------
id: :class:`int` id: :class:`int`
@ -1205,6 +1221,10 @@ class Client:
This method is an API call. For general usage, consider :meth:`get_guild` instead. 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 Parameters
----------- -----------
guild_id: :class:`int` guild_id: :class:`int`
@ -1239,6 +1259,10 @@ class Client:
Bot accounts in more than 10 guilds are not allowed to create guilds. 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 Parameters
---------- ----------
name: :class:`str` 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) 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) 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| """|coro|
Revokes an :class:`.Invite`, URL, or ID to an invite. 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 You must have the :attr:`~.Permissions.manage_channels` permission in
the associated guild to do this. the associated guild to do this.
.. versionchanged:: 2.0
``invite`` parameter is now positional-only.
Parameters Parameters
---------- ----------
invite: Union[:class:`.Invite`, :class:`str`] invite: Union[:class:`.Invite`, :class:`str`]
@ -1389,6 +1417,10 @@ class Client:
The guild must have the widget enabled to get this information. The guild must have the widget enabled to get this information.
.. versionchanged:: 2.0
``guild_id`` parameter is now positional-only.
Parameters Parameters
----------- -----------
guild_id: :class:`int` 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. 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 Parameters
----------- -----------
user_id: :class:`int` user_id: :class:`int`
@ -1472,6 +1508,10 @@ class Client:
.. versionadded:: 1.2 .. versionadded:: 1.2
.. versionchanged:: 2.0
``channel_id`` parameter is now positional-only.
Raises Raises
------- -------
:exc:`.InvalidData` :exc:`.InvalidData`
@ -1511,6 +1551,10 @@ class Client:
Retrieves a :class:`.Webhook` with the specified ID. Retrieves a :class:`.Webhook` with the specified ID.
.. versionchanged:: 2.0
``webhook_id`` parameter is now positional-only.
Raises Raises
-------- --------
:exc:`.HTTPException` :exc:`.HTTPException`

30
discord/ext/commands/bot.py

@ -227,12 +227,16 @@ class BotBase(GroupMixin):
self.add_check(func) # type: ignore self.add_check(func) # type: ignore
return func return func
def add_check(self, func: Check, *, call_once: bool = False) -> None: def add_check(self, func: Check, /, *, call_once: bool = False) -> None:
"""Adds a global check to the bot. """Adds a global check to the bot.
This is the non-decorator interface to :meth:`.check` This is the non-decorator interface to :meth:`.check`
and :meth:`.check_once`. and :meth:`.check_once`.
.. versionchanged:: 2.0
``func`` parameter is now positional-only.
Parameters Parameters
----------- -----------
func func
@ -247,12 +251,16 @@ class BotBase(GroupMixin):
else: else:
self._checks.append(func) self._checks.append(func)
def remove_check(self, func: Check, *, call_once: bool = False) -> None: def remove_check(self, func: Check, /, *, call_once: bool = False) -> None:
"""Removes a global check from the bot. """Removes a global check from the bot.
This function is idempotent and will not raise an exception This function is idempotent and will not raise an exception
if the function is not in the global checks. if the function is not in the global checks.
.. versionchanged:: 2.0
``func`` parameter is now positional-only.
Parameters Parameters
----------- -----------
func func
@ -510,7 +518,7 @@ class BotBase(GroupMixin):
# cogs # cogs
def add_cog(self, cog: Cog, *, override: bool = False) -> None: def add_cog(self, cog: Cog, /, *, override: bool = False) -> None:
"""Adds a "cog" to the bot. """Adds a "cog" to the bot.
A cog is a class that has its own event listeners and commands. A cog is a class that has its own event listeners and commands.
@ -520,6 +528,10 @@ class BotBase(GroupMixin):
:exc:`.ClientException` is raised when a cog with the same name :exc:`.ClientException` is raised when a cog with the same name
is already loaded. is already loaded.
.. versionchanged:: 2.0
``cog`` parameter is now positional-only.
Parameters Parameters
----------- -----------
cog: :class:`.Cog` cog: :class:`.Cog`
@ -554,11 +566,15 @@ class BotBase(GroupMixin):
cog = cog._inject(self) cog = cog._inject(self)
self.__cogs[cog_name] = cog self.__cogs[cog_name] = cog
def get_cog(self, name: str) -> Optional[Cog]: def get_cog(self, name: str, /) -> Optional[Cog]:
"""Gets the cog instance requested. """Gets the cog instance requested.
If the cog is not found, ``None`` is returned instead. If the cog is not found, ``None`` is returned instead.
.. versionchanged:: 2.0
``name`` parameter is now positional-only.
Parameters Parameters
----------- -----------
name: :class:`str` name: :class:`str`
@ -573,7 +589,7 @@ class BotBase(GroupMixin):
""" """
return self.__cogs.get(name) return self.__cogs.get(name)
def remove_cog(self, name: str) -> Optional[Cog]: def remove_cog(self, name: str, /) -> Optional[Cog]:
"""Removes a cog from the bot and returns it. """Removes a cog from the bot and returns it.
All registered commands and event listeners that the All registered commands and event listeners that the
@ -581,6 +597,10 @@ class BotBase(GroupMixin):
If no cog is found then this method has no effect. If no cog is found then this method has no effect.
.. versionchanged:: 2.0
``name`` parameter is now positional-only.
Parameters Parameters
----------- -----------
name: :class:`str` name: :class:`str`

4
discord/ext/commands/context.py

@ -170,6 +170,10 @@ class Context(discord.abc.Messageable, Generic[BotT]):
You must take care in passing the proper arguments when You must take care in passing the proper arguments when
using this function. using this function.
.. versionchanged:: 2.0
``command`` parameter is now positional-only.
Parameters Parameters
----------- -----------
command: :class:`.Command` command: :class:`.Command`

30
discord/ext/commands/core.py

@ -408,13 +408,17 @@ class Command(_BaseCommand, Generic[CogT, P, T]):
self.params = get_signature_parameters(function, globalns) self.params = get_signature_parameters(function, globalns)
def add_check(self, func: Check) -> None: def add_check(self, func: Check, /) -> None:
"""Adds a check to the command. """Adds a check to the command.
This is the non-decorator interface to :func:`.check`. This is the non-decorator interface to :func:`.check`.
.. versionadded:: 1.3 .. versionadded:: 1.3
.. versionchanged:: 2.0
``func`` parameter is now positional-only.
Parameters Parameters
----------- -----------
func func
@ -423,7 +427,7 @@ class Command(_BaseCommand, Generic[CogT, P, T]):
self.checks.append(func) self.checks.append(func)
def remove_check(self, func: Check) -> None: def remove_check(self, func: Check, /) -> None:
"""Removes a check from the command. """Removes a check from the command.
This function is idempotent and will not raise an exception This function is idempotent and will not raise an exception
@ -431,6 +435,10 @@ class Command(_BaseCommand, Generic[CogT, P, T]):
.. versionadded:: 1.3 .. versionadded:: 1.3
.. versionchanged:: 2.0
``func`` parameter is now positional-only.
Parameters Parameters
----------- -----------
func func
@ -1156,7 +1164,7 @@ class GroupMixin(Generic[CogT]):
command.recursively_remove_all_commands() command.recursively_remove_all_commands()
self.remove_command(command.name) self.remove_command(command.name)
def add_command(self, command: Command[CogT, Any, Any]) -> None: def add_command(self, command: Command[CogT, Any, Any], /) -> None:
"""Adds a :class:`.Command` into the internal list of commands. """Adds a :class:`.Command` into the internal list of commands.
This is usually not called, instead the :meth:`~.GroupMixin.command` or This is usually not called, instead the :meth:`~.GroupMixin.command` or
@ -1165,6 +1173,10 @@ class GroupMixin(Generic[CogT]):
.. versionchanged:: 1.4 .. versionchanged:: 1.4
Raise :exc:`.CommandRegistrationError` instead of generic :exc:`.ClientException` Raise :exc:`.CommandRegistrationError` instead of generic :exc:`.ClientException`
.. versionchanged:: 2.0
``command`` parameter is now positional-only.
Parameters Parameters
----------- -----------
command: :class:`Command` command: :class:`Command`
@ -1194,12 +1206,16 @@ class GroupMixin(Generic[CogT]):
raise CommandRegistrationError(alias, alias_conflict=True) raise CommandRegistrationError(alias, alias_conflict=True)
self.all_commands[alias] = command self.all_commands[alias] = command
def remove_command(self, name: str) -> Optional[Command[CogT, Any, Any]]: def remove_command(self, name: str, /) -> Optional[Command[CogT, Any, Any]]:
"""Remove a :class:`.Command` from the internal list """Remove a :class:`.Command` from the internal list
of commands. of commands.
This could also be used as a way to remove aliases. This could also be used as a way to remove aliases.
.. versionchanged:: 2.0
``name`` parameter is now positional-only.
Parameters Parameters
----------- -----------
name: :class:`str` name: :class:`str`
@ -1247,7 +1263,7 @@ class GroupMixin(Generic[CogT]):
if isinstance(command, GroupMixin): if isinstance(command, GroupMixin):
yield from command.walk_commands() yield from command.walk_commands()
def get_command(self, name: str) -> Optional[Command[CogT, Any, Any]]: def get_command(self, name: str, /) -> Optional[Command[CogT, Any, Any]]:
"""Get a :class:`.Command` from the internal list """Get a :class:`.Command` from the internal list
of commands. of commands.
@ -1257,6 +1273,10 @@ class GroupMixin(Generic[CogT]):
the subcommand ``bar`` of the group command ``foo``. If a the subcommand ``bar`` of the group command ``foo``. If a
subcommand is not found then ``None`` is returned just as usual. subcommand is not found then ``None`` is returned just as usual.
.. versionchanged:: 2.0
``name`` parameter is now positional-only.
Parameters Parameters
----------- -----------
name: :class:`str` name: :class:`str`

12
discord/ext/commands/help.py

@ -343,12 +343,16 @@ class HelpCommand:
bot.remove_command(self._command_impl.name) bot.remove_command(self._command_impl.name)
self._command_impl._eject_cog() self._command_impl._eject_cog()
def add_check(self, func): def add_check(self, func, /):
""" """
Adds a check to the help command. Adds a check to the help command.
.. versionadded:: 1.4 .. versionadded:: 1.4
.. versionchanged:: 2.0
``func`` parameter is now positional-only.
Parameters Parameters
---------- ----------
func func
@ -357,7 +361,7 @@ class HelpCommand:
self._command_impl.add_check(func) self._command_impl.add_check(func)
def remove_check(self, func): def remove_check(self, func, /):
""" """
Removes a check from the help command. Removes a check from the help command.
@ -366,6 +370,10 @@ class HelpCommand:
.. versionadded:: 1.4 .. versionadded:: 1.4
.. versionchanged:: 2.0
``func`` parameter is now positional-only.
Parameters Parameters
---------- ----------
func func

32
discord/guild.py

@ -639,6 +639,10 @@ class Guild(Hashable):
This does *not* search for threads. This does *not* search for threads.
.. versionchanged:: 2.0
``channel_id`` parameter is now positional-only.
Parameters Parameters
----------- -----------
channel_id: :class:`int` channel_id: :class:`int`
@ -741,6 +745,10 @@ class Guild(Hashable):
def get_member(self, user_id: int, /) -> Optional[Member]: def get_member(self, user_id: int, /) -> Optional[Member]:
"""Returns a member with the given ID. """Returns a member with the given ID.
.. versionchanged:: 2.0
``user_id`` parameter is now positional-only.
Parameters Parameters
----------- -----------
user_id: :class:`int` user_id: :class:`int`
@ -770,6 +778,10 @@ class Guild(Hashable):
def get_role(self, role_id: int, /) -> Optional[Role]: def get_role(self, role_id: int, /) -> Optional[Role]:
"""Returns a role with the given ID. """Returns a role with the given ID.
.. versionchanged:: 2.0
``role_id`` parameter is now positional-only.
Parameters Parameters
----------- -----------
role_id: :class:`int` role_id: :class:`int`
@ -926,6 +938,10 @@ class Guild(Hashable):
If no member is found, ``None`` is returned. If no member is found, ``None`` is returned.
.. versionchanged:: 2.0
``name`` parameter is now positional-only.
Parameters Parameters
----------- -----------
name: :class:`str` name: :class:`str`
@ -1696,6 +1712,10 @@ class Guild(Hashable):
This method is an API call. If you have :attr:`Intents.members` and member cache enabled, consider :meth:`get_member` instead. This method is an API call. If you have :attr:`Intents.members` and member cache enabled, consider :meth:`get_member` instead.
.. versionchanged:: 2.0
``member_id`` parameter is now positional-only.
Parameters Parameters
----------- -----------
member_id: :class:`int` member_id: :class:`int`
@ -2208,7 +2228,7 @@ class Guild(Hashable):
data = await self._state.http.create_guild_sticker(self.id, payload, file, reason) data = await self._state.http.create_guild_sticker(self.id, payload, file, reason)
return self._state.store_sticker(self, data) return self._state.store_sticker(self, data)
async def delete_sticker(self, sticker: Snowflake, *, reason: Optional[str] = None) -> None: async def delete_sticker(self, sticker: Snowflake, /, *, reason: Optional[str] = None) -> None:
"""|coro| """|coro|
Deletes the custom :class:`Sticker` from the guild. Deletes the custom :class:`Sticker` from the guild.
@ -2266,6 +2286,10 @@ class Guild(Hashable):
This method is an API call. This method is an API call.
For general usage, consider iterating over :attr:`emojis` instead. For general usage, consider iterating over :attr:`emojis` instead.
.. versionchanged:: 2.0
``emoji_id`` parameter is now positional-only.
Parameters Parameters
------------- -------------
emoji_id: :class:`int` emoji_id: :class:`int`
@ -2338,7 +2362,7 @@ class Guild(Hashable):
data = await self._state.http.create_custom_emoji(self.id, name, img, roles=role_ids, reason=reason) data = await self._state.http.create_custom_emoji(self.id, name, img, roles=role_ids, reason=reason)
return self._state.store_emoji(self, data) return self._state.store_emoji(self, data)
async def delete_emoji(self, emoji: Snowflake, *, reason: Optional[str] = None) -> None: async def delete_emoji(self, emoji: Snowflake, /, *, reason: Optional[str] = None) -> None:
"""|coro| """|coro|
Deletes the custom :class:`Emoji` from the guild. Deletes the custom :class:`Emoji` from the guild.
@ -2346,6 +2370,10 @@ class Guild(Hashable):
You must have :attr:`~Permissions.manage_emojis` permission to You must have :attr:`~Permissions.manage_emojis` permission to
do this. do this.
.. versionchanged:: 2.0
``emoji`` parameter is now positional-only.
Parameters Parameters
----------- -----------
emoji: :class:`abc.Snowflake` emoji: :class:`abc.Snowflake`

6
discord/message.py

@ -1376,7 +1376,7 @@ class Message(Hashable):
await self._state.http.unpin_message(self.channel.id, self.id, reason=reason) await self._state.http.unpin_message(self.channel.id, self.id, reason=reason)
self.pinned = False self.pinned = False
async def add_reaction(self, emoji: EmojiInputType) -> None: async def add_reaction(self, emoji: EmojiInputType, /) -> None:
"""|coro| """|coro|
Add a reaction to the message. Add a reaction to the message.
@ -1387,6 +1387,10 @@ class Message(Hashable):
to use this. If nobody else has reacted to the message using this to use this. If nobody else has reacted to the message using this
emoji, the :attr:`~Permissions.add_reactions` permission is required. emoji, the :attr:`~Permissions.add_reactions` permission is required.
.. versionchanged:: 2.0
``emoji`` parameter is now positional-only.
Parameters Parameters
------------ ------------
emoji: Union[:class:`Emoji`, :class:`Reaction`, :class:`PartialEmoji`, :class:`str`] emoji: Union[:class:`Emoji`, :class:`Reaction`, :class:`PartialEmoji`, :class:`str`]

4
discord/reaction.py

@ -161,6 +161,10 @@ class Reaction:
The ``after`` parameter must represent a member The ``after`` parameter must represent a member
and meet the :class:`abc.Snowflake` abc. and meet the :class:`abc.Snowflake` abc.
.. versionchanged:: 2.0
``limit`` and ``after`` parameters are now keyword-only.
Examples Examples
--------- ---------

15
discord/shard.py

@ -374,8 +374,19 @@ class AutoShardedClient(Client):
""" """
return [(shard_id, shard.ws.latency) for shard_id, shard in self.__shards.items()] return [(shard_id, shard.ws.latency) for shard_id, shard in self.__shards.items()]
def get_shard(self, shard_id: int) -> Optional[ShardInfo]: def get_shard(self, shard_id: int, /) -> Optional[ShardInfo]:
"""Optional[:class:`ShardInfo`]: Gets the shard information at a given shard ID or ``None`` if not found.""" """
Gets the shard information at a given shard ID or ``None`` if not found.
.. versionchanged:: 2.0
``shard_id`` parameter is now positional-only.
Returns
--------
Optional[:class:`ShardInfo`]
Information about the shard with given ID. ``None`` if not found.
"""
try: try:
parent = self.__shards[shard_id] parent = self.__shards[shard_id]
except KeyError: except KeyError:

6
discord/threads.py

@ -364,7 +364,7 @@ class Thread(Messageable, Hashable):
raise ClientException('Parent channel not found') raise ClientException('Parent channel not found')
return parent.permissions_for(obj) return parent.permissions_for(obj)
async def delete_messages(self, messages: Iterable[Snowflake]) -> None: async def delete_messages(self, messages: Iterable[Snowflake], /) -> None:
"""|coro| """|coro|
Deletes a list of messages. This is similar to :meth:`Message.delete` Deletes a list of messages. This is similar to :meth:`Message.delete`
@ -631,7 +631,7 @@ class Thread(Messageable, Hashable):
""" """
await self._state.http.leave_thread(self.id) await self._state.http.leave_thread(self.id)
async def add_user(self, user: Snowflake): async def add_user(self, user: Snowflake, /):
"""|coro| """|coro|
Adds a user to this thread. Adds a user to this thread.
@ -655,7 +655,7 @@ class Thread(Messageable, Hashable):
""" """
await self._state.http.add_user_to_thread(self.id, user.id) await self._state.http.add_user_to_thread(self.id, user.id)
async def remove_user(self, user: Snowflake): async def remove_user(self, user: Snowflake, /):
"""|coro| """|coro|
Removes a user from this thread. Removes a user from this thread.

5
discord/utils.py

@ -276,6 +276,11 @@ def oauth_url(
"""A helper function that returns the OAuth2 URL for inviting the bot """A helper function that returns the OAuth2 URL for inviting the bot
into guilds. into guilds.
.. versionchanged:: 2.0
``permissions``, ``guild``, ``redirect_uri``, and ``scopes`` parameters
are now keyword-only.
Parameters Parameters
----------- -----------
client_id: Union[:class:`int`, :class:`str`] client_id: Union[:class:`int`, :class:`str`]

6
discord/webhook/async_.py

@ -1422,7 +1422,7 @@ class Webhook(BaseWebhook):
return msg return msg
async def fetch_message(self, id: int) -> WebhookMessage: async def fetch_message(self, id: int, /) -> WebhookMessage:
"""|coro| """|coro|
Retrieves a single :class:`~discord.WebhookMessage` owned by this webhook. Retrieves a single :class:`~discord.WebhookMessage` owned by this webhook.
@ -1583,6 +1583,10 @@ class Webhook(BaseWebhook):
.. versionadded:: 1.6 .. versionadded:: 1.6
.. versionchanged:: 2.0
``message_id`` parameter is now positional-only.
Parameters Parameters
------------ ------------
message_id: :class:`int` message_id: :class:`int`

Loading…
Cancel
Save