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