aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2021-06-04 04:30:19 -0400
committerRapptz <[email protected]>2021-06-04 04:30:19 -0400
commitdbd9ed2c418b988d3413087ff1e724971a6c52a5 (patch)
tree86a08a6649962008a5fc7c42e31740523a592c6d
parentFix some typos in custom_context example (diff)
downloaddiscord.py-dbd9ed2c418b988d3413087ff1e724971a6c52a5.tar.xz
discord.py-dbd9ed2c418b988d3413087ff1e724971a6c52a5.zip
Add View.is_dispatching to detect whether a view has been added
-rw-r--r--discord/ui/view.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/discord/ui/view.py b/discord/ui/view.py
index f6dac241..4868196d 100644
--- a/discord/ui/view.py
+++ b/discord/ui/view.py
@@ -334,11 +334,16 @@ class View:
if self._cancel_callback:
self._cancel_callback(self)
+ self._cancel_callback = None
def is_finished(self) -> bool:
""":class:`bool`: Whether the view has finished interacting."""
return self._stopped.done()
+ def is_dispatching(self) -> bool:
+ """:class:`bool`: Whether the view has been added for dispatching purposes."""
+ return self._cancel_callback is not None
+
def is_persistent(self) -> bool:
""":class:`bool`: Whether the view is set up as persistent.