aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2021-05-31 00:18:06 -0400
committerRapptz <[email protected]>2021-05-31 00:18:06 -0400
commit4a3491cc0a012d5ea1594dd92c5e49f49739cad3 (patch)
tree8677e182278d92e8be274d4582180ac9d0a58f85
parentAdd support for editing in views in PartialMessage (diff)
downloaddiscord.py-4a3491cc0a012d5ea1594dd92c5e49f49739cad3.tar.xz
discord.py-4a3491cc0a012d5ea1594dd92c5e49f49739cad3.zip
Check for view finished state before resuming listening on edit
-rw-r--r--discord/interactions.py2
-rw-r--r--discord/message.py4
-rw-r--r--discord/webhook/async_.py2
3 files changed, 4 insertions, 4 deletions
diff --git a/discord/interactions.py b/discord/interactions.py
index 5017df95..3ff8d84f 100644
--- a/discord/interactions.py
+++ b/discord/interactions.py
@@ -418,7 +418,7 @@ class InteractionResponse:
data=payload,
)
- if view is not MISSING:
+ if view is not MISSING and not view.is_finished():
msg = self._parent.message
message_id = msg.id if msg else None
self._parent._state.store_view(view, message_id)
diff --git a/discord/message.py b/discord/message.py
index 41d8e21c..2af60bcf 100644
--- a/discord/message.py
+++ b/discord/message.py
@@ -1225,7 +1225,7 @@ class Message(Hashable):
data = await self._state.http.edit_message(self.channel.id, self.id, **fields)
self._update(data)
- if view:
+ if view and not view.is_finished():
self._state.store_view(view, self.id)
if delete_after is not None:
@@ -1700,6 +1700,6 @@ class PartialMessage(Hashable):
if fields:
msg = self._state.create_message(channel=self.channel, data=data) # type: ignore
- if view:
+ if view and not view.is_finished():
self._state.store_view(view, self.id)
return msg
diff --git a/discord/webhook/async_.py b/discord/webhook/async_.py
index 9d10f9e8..faea82a3 100644
--- a/discord/webhook/async_.py
+++ b/discord/webhook/async_.py
@@ -1327,7 +1327,7 @@ class Webhook(BaseWebhook):
if wait:
msg = self._create_message(data)
- if view is not MISSING:
+ if view is not MISSING and not view.is_finished():
message_id = None if msg is None else msg.id
self._state.store_view(view, message_id)