mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-07-23 11:26:51 +00:00
Address latest breaking change in creating forum posts
This commit is contained in:
parent
ef20264b1c
commit
06df0d7931
@ -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)
|
||||
|
@ -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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user