mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-07 20:28:38 +00:00
Add missing parameters to certain methods
- slowmode_delay and reason in Message.create_thread - slowmode_delay in TextChannel.create_thread - reason in Guild.edit_widget
This commit is contained in:
parent
12d4de52a8
commit
e15415413b
@ -713,6 +713,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
|
|||||||
type: Optional[ChannelType] = None,
|
type: Optional[ChannelType] = None,
|
||||||
reason: Optional[str] = None,
|
reason: Optional[str] = None,
|
||||||
invitable: bool = True,
|
invitable: bool = True,
|
||||||
|
slowmode_delay: Optional[int] = None,
|
||||||
) -> Thread:
|
) -> Thread:
|
||||||
"""|coro|
|
"""|coro|
|
||||||
|
|
||||||
@ -743,6 +744,10 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
|
|||||||
invitable: :class:`bool`
|
invitable: :class:`bool`
|
||||||
Whether non-modertators can add users to the thread. Only applicable to private threads.
|
Whether non-modertators can add users to the thread. Only applicable to private threads.
|
||||||
Defaults to ``True``.
|
Defaults to ``True``.
|
||||||
|
slowmode_delay: Optional[:class:`int`]
|
||||||
|
Specifies the slowmode rate limit for user in this channel, in seconds.
|
||||||
|
The maximum value possible is `21600`. By default no slowmode rate limit
|
||||||
|
if this is ``None``.
|
||||||
|
|
||||||
Raises
|
Raises
|
||||||
-------
|
-------
|
||||||
@ -768,6 +773,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
|
|||||||
type=type.value,
|
type=type.value,
|
||||||
reason=reason,
|
reason=reason,
|
||||||
invitable=invitable,
|
invitable=invitable,
|
||||||
|
rate_limit_per_user=slowmode_delay,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
data = await self._state.http.start_thread_with_message(
|
data = await self._state.http.start_thread_with_message(
|
||||||
@ -776,6 +782,7 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable):
|
|||||||
name=name,
|
name=name,
|
||||||
auto_archive_duration=auto_archive_duration or self.default_auto_archive_duration,
|
auto_archive_duration=auto_archive_duration or self.default_auto_archive_duration,
|
||||||
reason=reason,
|
reason=reason,
|
||||||
|
rate_limit_per_user=slowmode_delay,
|
||||||
)
|
)
|
||||||
|
|
||||||
return Thread(guild=self.guild, state=self._state, data=data)
|
return Thread(guild=self.guild, state=self._state, data=data)
|
||||||
|
@ -3335,7 +3335,13 @@ class Guild(Hashable):
|
|||||||
|
|
||||||
return Widget(state=self._state, data=data)
|
return Widget(state=self._state, data=data)
|
||||||
|
|
||||||
async def edit_widget(self, *, enabled: bool = MISSING, channel: Optional[Snowflake] = MISSING) -> None:
|
async def edit_widget(
|
||||||
|
self,
|
||||||
|
*,
|
||||||
|
enabled: bool = MISSING,
|
||||||
|
channel: Optional[Snowflake] = MISSING,
|
||||||
|
reason: Optional[str] = None,
|
||||||
|
) -> None:
|
||||||
"""|coro|
|
"""|coro|
|
||||||
|
|
||||||
Edits the widget of the guild.
|
Edits the widget of the guild.
|
||||||
@ -3351,6 +3357,8 @@ class Guild(Hashable):
|
|||||||
Whether to enable the widget for the guild.
|
Whether to enable the widget for the guild.
|
||||||
channel: Optional[:class:`~discord.abc.Snowflake`]
|
channel: Optional[:class:`~discord.abc.Snowflake`]
|
||||||
The new widget channel. ``None`` removes the widget channel.
|
The new widget channel. ``None`` removes the widget channel.
|
||||||
|
reason: Optional[:class:`str`]
|
||||||
|
The reason for editing this widget. Shows up on the audit log.
|
||||||
|
|
||||||
Raises
|
Raises
|
||||||
-------
|
-------
|
||||||
@ -3365,7 +3373,7 @@ class Guild(Hashable):
|
|||||||
if enabled is not MISSING:
|
if enabled is not MISSING:
|
||||||
payload['enabled'] = enabled
|
payload['enabled'] = enabled
|
||||||
|
|
||||||
await self._state.http.edit_widget(self.id, payload=payload)
|
await self._state.http.edit_widget(self.id, payload=payload, reason=reason)
|
||||||
|
|
||||||
async def chunk(self, *, cache: bool = True) -> Optional[List[Member]]:
|
async def chunk(self, *, cache: bool = True) -> Optional[List[Member]]:
|
||||||
"""|coro|
|
"""|coro|
|
||||||
|
@ -923,11 +923,13 @@ class HTTPClient:
|
|||||||
*,
|
*,
|
||||||
name: str,
|
name: str,
|
||||||
auto_archive_duration: threads.ThreadArchiveDuration,
|
auto_archive_duration: threads.ThreadArchiveDuration,
|
||||||
|
rate_limit_per_user: Optional[int] = None,
|
||||||
reason: Optional[str] = None,
|
reason: Optional[str] = None,
|
||||||
) -> Response[threads.Thread]:
|
) -> Response[threads.Thread]:
|
||||||
payload = {
|
payload = {
|
||||||
'name': name,
|
'name': name,
|
||||||
'auto_archive_duration': auto_archive_duration,
|
'auto_archive_duration': auto_archive_duration,
|
||||||
|
'rate_limit_per_user': rate_limit_per_user,
|
||||||
}
|
}
|
||||||
|
|
||||||
route = Route(
|
route = Route(
|
||||||
@ -943,6 +945,7 @@ class HTTPClient:
|
|||||||
auto_archive_duration: threads.ThreadArchiveDuration,
|
auto_archive_duration: threads.ThreadArchiveDuration,
|
||||||
type: threads.ThreadType,
|
type: threads.ThreadType,
|
||||||
invitable: bool = True,
|
invitable: bool = True,
|
||||||
|
rate_limit_per_user: Optional[int] = None,
|
||||||
reason: Optional[str] = None,
|
reason: Optional[str] = None,
|
||||||
) -> Response[threads.Thread]:
|
) -> Response[threads.Thread]:
|
||||||
payload = {
|
payload = {
|
||||||
@ -950,6 +953,7 @@ class HTTPClient:
|
|||||||
'auto_archive_duration': auto_archive_duration,
|
'auto_archive_duration': auto_archive_duration,
|
||||||
'type': type,
|
'type': type,
|
||||||
'invitable': invitable,
|
'invitable': invitable,
|
||||||
|
'rate_limit_per_user': rate_limit_per_user,
|
||||||
}
|
}
|
||||||
|
|
||||||
route = Route('POST', '/channels/{channel_id}/threads', channel_id=channel_id)
|
route = Route('POST', '/channels/{channel_id}/threads', channel_id=channel_id)
|
||||||
@ -1393,8 +1397,8 @@ class HTTPClient:
|
|||||||
def get_widget(self, guild_id: Snowflake) -> Response[widget.Widget]:
|
def get_widget(self, guild_id: Snowflake) -> Response[widget.Widget]:
|
||||||
return self.request(Route('GET', '/guilds/{guild_id}/widget.json', guild_id=guild_id))
|
return self.request(Route('GET', '/guilds/{guild_id}/widget.json', guild_id=guild_id))
|
||||||
|
|
||||||
def edit_widget(self, guild_id: Snowflake, payload) -> Response[widget.WidgetSettings]:
|
def edit_widget(self, guild_id: Snowflake, payload, reason: Optional[str] = None) -> Response[widget.WidgetSettings]:
|
||||||
return self.request(Route('PATCH', '/guilds/{guild_id}/widget', guild_id=guild_id), json=payload)
|
return self.request(Route('PATCH', '/guilds/{guild_id}/widget', guild_id=guild_id), json=payload, reason=reason)
|
||||||
|
|
||||||
# Invite management
|
# Invite management
|
||||||
|
|
||||||
|
@ -1595,7 +1595,14 @@ class Message(Hashable):
|
|||||||
"""
|
"""
|
||||||
await self._state.http.clear_reactions(self.channel.id, self.id)
|
await self._state.http.clear_reactions(self.channel.id, self.id)
|
||||||
|
|
||||||
async def create_thread(self, *, name: str, auto_archive_duration: ThreadArchiveDuration = MISSING) -> Thread:
|
async def create_thread(
|
||||||
|
self,
|
||||||
|
*,
|
||||||
|
name: str,
|
||||||
|
auto_archive_duration: ThreadArchiveDuration = MISSING,
|
||||||
|
slowmode_delay: Optional[int] = None,
|
||||||
|
reason: Optional[str] = None,
|
||||||
|
) -> Thread:
|
||||||
"""|coro|
|
"""|coro|
|
||||||
|
|
||||||
Creates a public thread from this message.
|
Creates a public thread from this message.
|
||||||
@ -1614,6 +1621,12 @@ class Message(Hashable):
|
|||||||
auto_archive_duration: :class:`int`
|
auto_archive_duration: :class:`int`
|
||||||
The duration in minutes before a thread is automatically archived for inactivity.
|
The duration in minutes before a thread is automatically archived for inactivity.
|
||||||
If not provided, the channel's default auto archive duration is used.
|
If not provided, the channel's default auto archive duration is used.
|
||||||
|
slowmode_delay: Optional[:class:`int`]
|
||||||
|
Specifies the slowmode rate limit for user in this channel, in seconds.
|
||||||
|
The maximum value possible is `21600`. By default no slowmode rate limit
|
||||||
|
if this is ``None``.
|
||||||
|
reason: Optional[:class:`str`]
|
||||||
|
The reason for creating a new thread. Shows up on the audit log.
|
||||||
|
|
||||||
Raises
|
Raises
|
||||||
-------
|
-------
|
||||||
@ -1638,6 +1651,8 @@ class Message(Hashable):
|
|||||||
self.id,
|
self.id,
|
||||||
name=name,
|
name=name,
|
||||||
auto_archive_duration=auto_archive_duration or default_auto_archive_duration,
|
auto_archive_duration=auto_archive_duration or default_auto_archive_duration,
|
||||||
|
rate_limit_per_user=slowmode_delay,
|
||||||
|
reason=reason,
|
||||||
)
|
)
|
||||||
return Thread(guild=self.guild, state=self._state, data=data)
|
return Thread(guild=self.guild, state=self._state, data=data)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user