@ -258,6 +258,16 @@ class ShardInfo:
""" :class:`float`: Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds for this shard. """
""" :class:`float`: Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds for this shard. """
return self . _parent . ws . latency
return self . _parent . 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
"""
return self . _parent . ws . is_ratelimited ( )
class AutoShardedClient ( Client ) :
class AutoShardedClient ( Client ) :
""" A client similar to :class:`Client` except it handles the complications
""" A client similar to :class:`Client` except it handles the complications
of sharding for the user into a more manageable and transparent single
of sharding for the user into a more manageable and transparent single
@ -519,3 +529,16 @@ class AutoShardedClient(Client):
me . activities = activities
me . activities = activities
me . status = status_enum
me . status = status_enum
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 .
This implementation checks if any of the shards are rate limited .
For more granular control , consider : meth : ` ShardInfo . is_ws_ratelimited ` .
. . versionadded : : 1.6
"""
return any ( shard . ws . is_ratelimited ( ) for shard in self . __shards . values ( ) )