diff --git a/discord/channel.py b/discord/channel.py index 64b4dbfaf..1aa9e477f 100644 --- a/discord/channel.py +++ b/discord/channel.py @@ -2244,7 +2244,7 @@ class ForumChannel(discord.abc.GuildChannel, Hashable): content = str(content) if content else MISSING - extras = { + channel_payload = { 'name': name, 'auto_archive_duration': auto_archive_duration or self.default_auto_archive_duration, 'rate_limit_per_user': slowmode_delay, @@ -2264,7 +2264,7 @@ class ForumChannel(discord.abc.GuildChannel, Hashable): stickers=sticker_ids, view=view, flags=flags, - extras=extras, + channel_payload=channel_payload, ) as params: data = await state.http.start_thread_in_forum(self.id, params=params, reason=reason) return Thread(guild=self.guild, state=self._state, data=data) diff --git a/discord/http.py b/discord/http.py index 2cd6bd1b7..226e2dda9 100644 --- a/discord/http.py +++ b/discord/http.py @@ -147,7 +147,7 @@ def handle_message_parameters( stickers: Optional[SnowflakeList] = MISSING, previous_allowed_mentions: Optional[AllowedMentions] = None, mention_author: Optional[bool] = None, - extras: Dict[str, Any] = MISSING, + channel_payload: Dict[str, Any] = MISSING, ) -> MultipartParameters: if files is not MISSING and file is not MISSING: raise TypeError('Cannot mix file and files keyword arguments.') @@ -235,8 +235,11 @@ def handle_message_parameters( payload['attachments'] = attachments_payload - if extras is not MISSING: - payload.update(extras) + if channel_payload is not MISSING: + payload = { + 'message': payload, + } + payload.update(channel_payload) multipart = [] if files: @@ -988,11 +991,12 @@ class HTTPClient: params: MultipartParameters, reason: Optional[str] = None, ) -> Response[threads.Thread]: + query = {'use_nested_fields': 1} r = Route('POST', '/channels/{channel_id}/threads', channel_id=channel_id) if params.files: - return self.request(r, files=params.files, form=params.multipart, reason=reason) + return self.request(r, files=params.files, form=params.multipart, params=query, reason=reason) else: - return self.request(r, json=params.payload, reason=reason) + return self.request(r, json=params.payload, params=query, reason=reason) def join_thread(self, channel_id: Snowflake) -> Response[None]: return self.request(Route('POST', '/channels/{channel_id}/thread-members/@me', channel_id=channel_id))