aboutsummaryrefslogtreecommitdiff
path: root/discord/client.py
diff options
context:
space:
mode:
Diffstat (limited to 'discord/client.py')
-rw-r--r--discord/client.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/discord/client.py b/discord/client.py
index 1ddb09d6..a5bb9c00 100644
--- a/discord/client.py
+++ b/discord/client.py
@@ -282,6 +282,18 @@ class Client:
ws = self.ws
return float('nan') if not ws else ws.latency
+ def is_ws_ratelimited(self):
+ """:class:`bool`: Whether the websocket is currently rate limited.
+
+ This can be useful to know when deciding whether you should query members
+ using HTTP or via the gateway.
+
+ .. versionadded:: 1.6
+ """
+ if self.ws:
+ return self.ws.is_ratelimited()
+ return False
+
@property
def user(self):
"""Optional[:class:`.ClientUser`]: Represents the connected client. ``None`` if not logged in."""