mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-19 15:36:02 +00:00
Add positional-only arguments in more places
This commit is contained in:
parent
19b10eecfe
commit
dc19c6c7d5
@ -546,6 +546,9 @@ class GuildChannel:
|
||||
.. versionchanged:: 2.0
|
||||
The object passed in can now be a role object.
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
``obj`` parameter is now positional-only.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
obj: Union[:class:`~discord.Member`, :class:`~discord.Role`]
|
||||
|
@ -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
|
||||
)
|
||||
|
||||
async def delete_messages(self, messages: Iterable[Snowflake]) -> None:
|
||||
async def delete_messages(self, messages: Iterable[Snowflake], /) -> None:
|
||||
"""|coro|
|
||||
|
||||
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
|
||||
use this.
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
|
||||
``messages`` parameter is now positional-only.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
messages: Iterable[:class:`abc.Snowflake`]
|
||||
@ -639,6 +643,10 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
|
||||
|
||||
.. versionadded:: 1.6
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
|
||||
``message_id`` parameter is now positional-only.
|
||||
|
||||
Parameters
|
||||
------------
|
||||
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.manage_messages`: You cannot delete others messages in a DM.
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
|
||||
``obj`` parameter is now positional-only.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
obj: :class:`User`
|
||||
@ -1822,6 +1834,10 @@ class DMChannel(discord.abc.Messageable, Hashable):
|
||||
|
||||
.. versionadded:: 1.6
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
|
||||
``message_id`` parameter is now positional-only.
|
||||
|
||||
Parameters
|
||||
------------
|
||||
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.
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
|
||||
``obj`` parameter is now positional-only.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
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
|
||||
doing an unnecessary API call.
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
|
||||
``message_id`` parameter is now positional-only.
|
||||
|
||||
Parameters
|
||||
------------
|
||||
message_id: :class:`int`
|
||||
|
@ -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`
|
||||
|
@ -227,12 +227,16 @@ class BotBase(GroupMixin):
|
||||
self.add_check(func) # type: ignore
|
||||
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.
|
||||
|
||||
This is the non-decorator interface to :meth:`.check`
|
||||
and :meth:`.check_once`.
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
|
||||
``func`` parameter is now positional-only.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
func
|
||||
@ -247,12 +251,16 @@ class BotBase(GroupMixin):
|
||||
else:
|
||||
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.
|
||||
|
||||
This function is idempotent and will not raise an exception
|
||||
if the function is not in the global checks.
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
|
||||
``func`` parameter is now positional-only.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
func
|
||||
@ -510,7 +518,7 @@ class BotBase(GroupMixin):
|
||||
|
||||
# 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.
|
||||
|
||||
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
|
||||
is already loaded.
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
|
||||
``cog`` parameter is now positional-only.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
cog: :class:`.Cog`
|
||||
@ -554,11 +566,15 @@ class BotBase(GroupMixin):
|
||||
cog = cog._inject(self)
|
||||
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.
|
||||
|
||||
If the cog is not found, ``None`` is returned instead.
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
|
||||
``name`` parameter is now positional-only.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
name: :class:`str`
|
||||
@ -573,7 +589,7 @@ class BotBase(GroupMixin):
|
||||
"""
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
|
||||
``name`` parameter is now positional-only.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
name: :class:`str`
|
||||
|
@ -170,6 +170,10 @@ class Context(discord.abc.Messageable, Generic[BotT]):
|
||||
You must take care in passing the proper arguments when
|
||||
using this function.
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
|
||||
``command`` parameter is now positional-only.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
command: :class:`.Command`
|
||||
|
@ -408,13 +408,17 @@ class Command(_BaseCommand, Generic[CogT, P, T]):
|
||||
|
||||
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.
|
||||
|
||||
This is the non-decorator interface to :func:`.check`.
|
||||
|
||||
.. versionadded:: 1.3
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
|
||||
``func`` parameter is now positional-only.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
func
|
||||
@ -423,7 +427,7 @@ class Command(_BaseCommand, Generic[CogT, P, T]):
|
||||
|
||||
self.checks.append(func)
|
||||
|
||||
def remove_check(self, func: Check) -> None:
|
||||
def remove_check(self, func: Check, /) -> None:
|
||||
"""Removes a check from the command.
|
||||
|
||||
This function is idempotent and will not raise an exception
|
||||
@ -431,6 +435,10 @@ class Command(_BaseCommand, Generic[CogT, P, T]):
|
||||
|
||||
.. versionadded:: 1.3
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
|
||||
``func`` parameter is now positional-only.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
func
|
||||
@ -1156,7 +1164,7 @@ class GroupMixin(Generic[CogT]):
|
||||
command.recursively_remove_all_commands()
|
||||
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.
|
||||
|
||||
This is usually not called, instead the :meth:`~.GroupMixin.command` or
|
||||
@ -1165,6 +1173,10 @@ class GroupMixin(Generic[CogT]):
|
||||
.. versionchanged:: 1.4
|
||||
Raise :exc:`.CommandRegistrationError` instead of generic :exc:`.ClientException`
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
|
||||
``command`` parameter is now positional-only.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
command: :class:`Command`
|
||||
@ -1194,12 +1206,16 @@ class GroupMixin(Generic[CogT]):
|
||||
raise CommandRegistrationError(alias, alias_conflict=True)
|
||||
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
|
||||
of commands.
|
||||
|
||||
This could also be used as a way to remove aliases.
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
|
||||
``name`` parameter is now positional-only.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
name: :class:`str`
|
||||
@ -1247,7 +1263,7 @@ class GroupMixin(Generic[CogT]):
|
||||
if isinstance(command, GroupMixin):
|
||||
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
|
||||
of commands.
|
||||
|
||||
@ -1257,6 +1273,10 @@ class GroupMixin(Generic[CogT]):
|
||||
the subcommand ``bar`` of the group command ``foo``. If a
|
||||
subcommand is not found then ``None`` is returned just as usual.
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
|
||||
``name`` parameter is now positional-only.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
name: :class:`str`
|
||||
|
@ -343,12 +343,16 @@ class HelpCommand:
|
||||
bot.remove_command(self._command_impl.name)
|
||||
self._command_impl._eject_cog()
|
||||
|
||||
def add_check(self, func):
|
||||
def add_check(self, func, /):
|
||||
"""
|
||||
Adds a check to the help command.
|
||||
|
||||
.. versionadded:: 1.4
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
|
||||
``func`` parameter is now positional-only.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
func
|
||||
@ -357,7 +361,7 @@ class HelpCommand:
|
||||
|
||||
self._command_impl.add_check(func)
|
||||
|
||||
def remove_check(self, func):
|
||||
def remove_check(self, func, /):
|
||||
"""
|
||||
Removes a check from the help command.
|
||||
|
||||
@ -366,6 +370,10 @@ class HelpCommand:
|
||||
|
||||
.. versionadded:: 1.4
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
|
||||
``func`` parameter is now positional-only.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
func
|
||||
|
@ -639,6 +639,10 @@ class Guild(Hashable):
|
||||
|
||||
This does *not* search for threads.
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
|
||||
``channel_id`` parameter is now positional-only.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
channel_id: :class:`int`
|
||||
@ -741,6 +745,10 @@ class Guild(Hashable):
|
||||
def get_member(self, user_id: int, /) -> Optional[Member]:
|
||||
"""Returns a member with the given ID.
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
|
||||
``user_id`` parameter is now positional-only.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
user_id: :class:`int`
|
||||
@ -770,6 +778,10 @@ class Guild(Hashable):
|
||||
def get_role(self, role_id: int, /) -> Optional[Role]:
|
||||
"""Returns a role with the given ID.
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
|
||||
``role_id`` parameter is now positional-only.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
role_id: :class:`int`
|
||||
@ -926,6 +938,10 @@ class Guild(Hashable):
|
||||
|
||||
If no member is found, ``None`` is returned.
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
|
||||
``name`` parameter is now positional-only.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
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.
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
|
||||
``member_id`` parameter is now positional-only.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
member_id: :class:`int`
|
||||
@ -2208,7 +2228,7 @@ class Guild(Hashable):
|
||||
data = await self._state.http.create_guild_sticker(self.id, payload, file, reason)
|
||||
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|
|
||||
|
||||
Deletes the custom :class:`Sticker` from the guild.
|
||||
@ -2266,6 +2286,10 @@ class Guild(Hashable):
|
||||
This method is an API call.
|
||||
For general usage, consider iterating over :attr:`emojis` instead.
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
|
||||
``emoji_id`` parameter is now positional-only.
|
||||
|
||||
Parameters
|
||||
-------------
|
||||
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)
|
||||
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|
|
||||
|
||||
Deletes the custom :class:`Emoji` from the guild.
|
||||
@ -2346,6 +2370,10 @@ class Guild(Hashable):
|
||||
You must have :attr:`~Permissions.manage_emojis` permission to
|
||||
do this.
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
|
||||
``emoji`` parameter is now positional-only.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
emoji: :class:`abc.Snowflake`
|
||||
|
@ -1376,7 +1376,7 @@ class Message(Hashable):
|
||||
await self._state.http.unpin_message(self.channel.id, self.id, reason=reason)
|
||||
self.pinned = False
|
||||
|
||||
async def add_reaction(self, emoji: EmojiInputType) -> None:
|
||||
async def add_reaction(self, emoji: EmojiInputType, /) -> None:
|
||||
"""|coro|
|
||||
|
||||
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
|
||||
emoji, the :attr:`~Permissions.add_reactions` permission is required.
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
|
||||
``emoji`` parameter is now positional-only.
|
||||
|
||||
Parameters
|
||||
------------
|
||||
emoji: Union[:class:`Emoji`, :class:`Reaction`, :class:`PartialEmoji`, :class:`str`]
|
||||
|
@ -161,6 +161,10 @@ class Reaction:
|
||||
The ``after`` parameter must represent a member
|
||||
and meet the :class:`abc.Snowflake` abc.
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
|
||||
``limit`` and ``after`` parameters are now keyword-only.
|
||||
|
||||
Examples
|
||||
---------
|
||||
|
||||
|
@ -374,8 +374,19 @@ class AutoShardedClient(Client):
|
||||
"""
|
||||
return [(shard_id, shard.ws.latency) for shard_id, shard in self.__shards.items()]
|
||||
|
||||
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."""
|
||||
def get_shard(self, shard_id: int, /) -> Optional[ShardInfo]:
|
||||
"""
|
||||
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:
|
||||
parent = self.__shards[shard_id]
|
||||
except KeyError:
|
||||
|
@ -364,7 +364,7 @@ class Thread(Messageable, Hashable):
|
||||
raise ClientException('Parent channel not found')
|
||||
return parent.permissions_for(obj)
|
||||
|
||||
async def delete_messages(self, messages: Iterable[Snowflake]) -> None:
|
||||
async def delete_messages(self, messages: Iterable[Snowflake], /) -> None:
|
||||
"""|coro|
|
||||
|
||||
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)
|
||||
|
||||
async def add_user(self, user: Snowflake):
|
||||
async def add_user(self, user: Snowflake, /):
|
||||
"""|coro|
|
||||
|
||||
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)
|
||||
|
||||
async def remove_user(self, user: Snowflake):
|
||||
async def remove_user(self, user: Snowflake, /):
|
||||
"""|coro|
|
||||
|
||||
Removes a user from this thread.
|
||||
|
@ -276,6 +276,11 @@ def oauth_url(
|
||||
"""A helper function that returns the OAuth2 URL for inviting the bot
|
||||
into guilds.
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
|
||||
``permissions``, ``guild``, ``redirect_uri``, and ``scopes`` parameters
|
||||
are now keyword-only.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
client_id: Union[:class:`int`, :class:`str`]
|
||||
|
@ -1422,7 +1422,7 @@ class Webhook(BaseWebhook):
|
||||
|
||||
return msg
|
||||
|
||||
async def fetch_message(self, id: int) -> WebhookMessage:
|
||||
async def fetch_message(self, id: int, /) -> WebhookMessage:
|
||||
"""|coro|
|
||||
|
||||
Retrieves a single :class:`~discord.WebhookMessage` owned by this webhook.
|
||||
@ -1583,6 +1583,10 @@ class Webhook(BaseWebhook):
|
||||
|
||||
.. versionadded:: 1.6
|
||||
|
||||
.. versionchanged:: 2.0
|
||||
|
||||
``message_id`` parameter is now positional-only.
|
||||
|
||||
Parameters
|
||||
------------
|
||||
message_id: :class:`int`
|
||||
|
Loading…
x
Reference in New Issue
Block a user