mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-07-02 00:00:02 +00:00
Fix webhooks and interactions not closing files after a request
This commit is contained in:
parent
faee0b4968
commit
7e95f98521
@ -450,7 +450,7 @@ class Interaction(Generic[ClientT]):
|
||||
"""
|
||||
|
||||
previous_mentions: Optional[AllowedMentions] = self._state.allowed_mentions
|
||||
params = handle_message_parameters(
|
||||
with handle_message_parameters(
|
||||
content=content,
|
||||
attachments=attachments,
|
||||
embed=embed,
|
||||
@ -458,7 +458,7 @@ class Interaction(Generic[ClientT]):
|
||||
view=view,
|
||||
allowed_mentions=allowed_mentions,
|
||||
previous_allowed_mentions=previous_mentions,
|
||||
)
|
||||
) as params:
|
||||
adapter = async_context.get()
|
||||
http = self._state.http
|
||||
data = await adapter.edit_original_interaction_response(
|
||||
|
@ -952,7 +952,7 @@ class PartialMessage(Hashable):
|
||||
if view is not MISSING:
|
||||
self._state.prevent_view_updates_for(self.id)
|
||||
|
||||
params = handle_message_parameters(
|
||||
with handle_message_parameters(
|
||||
content=content,
|
||||
embed=embed,
|
||||
embeds=embeds,
|
||||
@ -960,7 +960,7 @@ class PartialMessage(Hashable):
|
||||
view=view,
|
||||
allowed_mentions=allowed_mentions,
|
||||
previous_allowed_mentions=previous_allowed_mentions,
|
||||
)
|
||||
) as params:
|
||||
data = await self._state.http.edit_message(self.channel.id, self.id, params=params)
|
||||
message = Message(state=self._state, channel=self.channel, data=data)
|
||||
|
||||
@ -2141,7 +2141,7 @@ class Message(PartialMessage, Hashable):
|
||||
if view is not MISSING:
|
||||
self._state.prevent_view_updates_for(self.id)
|
||||
|
||||
params = handle_message_parameters(
|
||||
with handle_message_parameters(
|
||||
content=content,
|
||||
flags=flags,
|
||||
embed=embed,
|
||||
@ -2150,7 +2150,7 @@ class Message(PartialMessage, Hashable):
|
||||
view=view,
|
||||
allowed_mentions=allowed_mentions,
|
||||
previous_allowed_mentions=previous_allowed_mentions,
|
||||
)
|
||||
) as params:
|
||||
data = await self._state.http.edit_message(self.channel.id, self.id, params=params)
|
||||
message = Message(state=self._state, channel=self.channel, data=data)
|
||||
|
||||
|
@ -1711,7 +1711,7 @@ class Webhook(BaseWebhook):
|
||||
if thread_name is not MISSING and thread is not MISSING:
|
||||
raise TypeError('Cannot mix thread_name and thread keyword arguments.')
|
||||
|
||||
params = handle_message_parameters(
|
||||
with handle_message_parameters(
|
||||
content=content,
|
||||
username=username,
|
||||
avatar_url=avatar_url,
|
||||
@ -1725,7 +1725,7 @@ class Webhook(BaseWebhook):
|
||||
thread_name=thread_name,
|
||||
allowed_mentions=allowed_mentions,
|
||||
previous_allowed_mentions=previous_mentions,
|
||||
)
|
||||
) as params:
|
||||
adapter = async_context.get()
|
||||
thread_id: Optional[int] = None
|
||||
if thread is not MISSING:
|
||||
@ -1891,7 +1891,7 @@ class Webhook(BaseWebhook):
|
||||
self._state.prevent_view_updates_for(message_id)
|
||||
|
||||
previous_mentions: Optional[AllowedMentions] = getattr(self._state, 'allowed_mentions', None)
|
||||
params = handle_message_parameters(
|
||||
with handle_message_parameters(
|
||||
content=content,
|
||||
attachments=attachments,
|
||||
embed=embed,
|
||||
@ -1899,8 +1899,7 @@ class Webhook(BaseWebhook):
|
||||
view=view,
|
||||
allowed_mentions=allowed_mentions,
|
||||
previous_allowed_mentions=previous_mentions,
|
||||
)
|
||||
|
||||
) as params:
|
||||
thread_id: Optional[int] = None
|
||||
if thread is not MISSING:
|
||||
thread_id = thread.id
|
||||
|
@ -1005,7 +1005,7 @@ class SyncWebhook(BaseWebhook):
|
||||
if thread_name is not MISSING and thread is not MISSING:
|
||||
raise TypeError('Cannot mix thread_name and thread keyword arguments.')
|
||||
|
||||
params = handle_message_parameters(
|
||||
with handle_message_parameters(
|
||||
content=content,
|
||||
username=username,
|
||||
avatar_url=avatar_url,
|
||||
@ -1018,7 +1018,7 @@ class SyncWebhook(BaseWebhook):
|
||||
allowed_mentions=allowed_mentions,
|
||||
previous_allowed_mentions=previous_mentions,
|
||||
flags=flags,
|
||||
)
|
||||
) as params:
|
||||
adapter: WebhookAdapter = _get_webhook_adapter()
|
||||
thread_id: Optional[int] = None
|
||||
if thread is not MISSING:
|
||||
@ -1034,6 +1034,7 @@ class SyncWebhook(BaseWebhook):
|
||||
thread_id=thread_id,
|
||||
wait=wait,
|
||||
)
|
||||
|
||||
if wait:
|
||||
return self._create_message(data, thread=thread)
|
||||
|
||||
@ -1142,15 +1143,14 @@ class SyncWebhook(BaseWebhook):
|
||||
raise ValueError('This webhook does not have a token associated with it')
|
||||
|
||||
previous_mentions: Optional[AllowedMentions] = getattr(self._state, 'allowed_mentions', None)
|
||||
params = handle_message_parameters(
|
||||
with handle_message_parameters(
|
||||
content=content,
|
||||
attachments=attachments,
|
||||
embed=embed,
|
||||
embeds=embeds,
|
||||
allowed_mentions=allowed_mentions,
|
||||
previous_allowed_mentions=previous_mentions,
|
||||
)
|
||||
|
||||
) as params:
|
||||
thread_id: Optional[int] = None
|
||||
if thread is not MISSING:
|
||||
thread_id = thread.id
|
||||
|
Loading…
x
Reference in New Issue
Block a user