Skip to content

Commit

Permalink
Rename start_thread to create_thread for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
Rapptz committed Aug 12, 2021
1 parent fda543c commit 1e17b7f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
20 changes: 10 additions & 10 deletions discord/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ def get_thread(self, thread_id: int, /) -> Optional[Thread]:
"""
return self.guild.get_thread(thread_id)

async def start_thread(
async def create_thread(
self,
*,
name: str,
Expand All @@ -668,17 +668,17 @@ async def start_thread(
) -> Thread:
"""|coro|
Starts a thread in this text channel.
Creates a thread in this text channel.
If no starter message is passed with the ``message`` parameter then
you must have :attr:`~discord.Permissions.send_messages` and
:attr:`~discord.Permissions.use_private_threads` in order to start the thread
:attr:`~discord.Permissions.use_private_threads` in order to create the thread
if the ``type`` parameter is :attr:`~discord.ChannelType.private_thread`.
Otherwise :attr:`~discord.Permissions.use_threads` is needed.
If a starter message is passed with the ``message`` parameter then
you must have :attr:`~discord.Permissions.send_messages` and
:attr:`~discord.Permissions.use_threads` in order to start the thread.
:attr:`~discord.Permissions.use_threads` in order to create the thread.
.. versionadded:: 2.0
Expand All @@ -687,30 +687,30 @@ async def start_thread(
name: :class:`str`
The name of the thread.
message: Optional[:class:`abc.Snowflake`]
A snowflake representing the message to start the thread with.
If ``None`` is passed then a private thread is started.
A snowflake representing the message to create the thread with.
If ``None`` is passed then a private thread is created.
Defaults to ``None``.
auto_archive_duration: :class:`int`
The duration in minutes before a thread is automatically archived for inactivity.
Defaults to ``1440`` or 24 hours.
type: Optional[:class:`ChannelType`]
The type of thread to create. If a ``message`` is passed then this parameter
is ignored, as a thread started with a message is always a public thread.
is ignored, as a thread created with a message is always a public thread.
By default this creates a private thread if this is ``None``.
reason: :class:`str`
The reason for starting a new thread. Shows up on the audit log.
The reason for creating a new thread. Shows up on the audit log.
Raises
-------
Forbidden
You do not have permissions to start a thread.
You do not have permissions to create a thread.
HTTPException
Starting the thread failed.
Returns
--------
:class:`Thread`
The started thread
The created thread
"""

if type is None:
Expand Down
12 changes: 6 additions & 6 deletions discord/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -1476,13 +1476,13 @@ async def clear_reactions(self) -> None:
"""
await self._state.http.clear_reactions(self.channel.id, self.id)

async def start_thread(self, *, name: str, auto_archive_duration: ThreadArchiveDuration = 1440) -> Thread:
async def create_thread(self, *, name: str, auto_archive_duration: ThreadArchiveDuration = 1440) -> Thread:
"""|coro|
Starts a public thread from this message.
Creates a public thread from this message.
You must have :attr:`~discord.Permissions.send_messages` and
:attr:`~discord.Permissions.use_threads` in order to start a thread.
:attr:`~discord.Permissions.use_threads` in order to create a thread.
The channel this message belongs in must be a :class:`TextChannel`.
Expand All @@ -1497,16 +1497,16 @@ async def start_thread(self, *, name: str, auto_archive_duration: ThreadArchiveD
Raises
-------
Forbidden
You do not have permissions to start a thread.
You do not have permissions to create a thread.
HTTPException
Starting the thread failed.
Creating the thread failed.
InvalidArgument
This message does not have guild info attached.
Returns
--------
:class:`.Thread`
The started thread.
The created thread.
"""
if self.guild is None:
raise InvalidArgument('This message does not have guild info attached.')
Expand Down

0 comments on commit 1e17b7f

Please sign in to comment.