some docstrings and shard latency property

This commit is contained in:
grey-cat-1908 2022-03-12 16:30:04 +03:00
parent 0499235fac
commit 2a6f1067d7

View file

@ -25,11 +25,16 @@ class Shard:
"""Id of Shard""" """Id of Shard"""
return self._gateway.shard_id return self._gateway.shard_id
# @property @property
# def def latency(self) -> float:
""":class:`float`:
Measures latency between a HEARTBEAT command and a HEARTBEAT_ACK event in seconds for this shard"""
return self._gateway.latency
async def launch(self, **kwargs) -> Shard: async def launch(self, **kwargs) -> Shard:
"""Launches new shard""" """|coro|
Launches new shard"""
self._gateway = Gateway(self._client, self._gateway = Gateway(self._client,
self._shard_id, self._shard_id,
self._num_shards, self._num_shards,
@ -51,6 +56,8 @@ class Shard:
async def update_presence(self, activity: BotActivity = None, status: str = None) -> Shard: async def update_presence(self, activity: BotActivity = None, status: str = None) -> Shard:
""" """
|coro|
Update Presence for the shard Update Presence for the shard
Parameters Parameters
@ -66,11 +73,16 @@ class Shard:
return self return self
async def disconnect(self) -> None: async def disconnect(self) -> None:
"""Disconnect current shard""" """
|coro|
Disconnect current shard"""
await self._try_close() await self._try_close()
async def reconnect(self, wait_time: int = 3) -> None: async def reconnect(self, wait_time: int = 3) -> None:
"""Reconnect current shard """|coro|
Reconnect current shard
Parameters Parameters
---------- ----------