diff options
| author | verixx <[email protected]> | 2017-11-02 20:52:26 +1100 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-11-12 16:58:30 -0500 |
| commit | 542924d5df8553ded17bb7ec4b724d85a1d44820 (patch) | |
| tree | 8cd5a58f355e81a14f6652c04c9038294c1411bb /docs/api.rst | |
| parent | Fix Spelling Error (diff) | |
| download | discord.py-542924d5df8553ded17bb7ec4b724d85a1d44820.tar.xz discord.py-542924d5df8553ded17bb7ec4b724d85a1d44820.zip | |
Fixed a zero division error when accessing latencies
When accessing the latencies property on an AutoShardedClient when none of shards are ready, we get a ZeroDivisionError. An example of this can be seen here.
```py
class StatsBot(commands.AutoShardedBot):
def __init__(self):
super().__init__(command_prefix=None)
self._add_commands()
def _add_commands(self):
'''Adds commands automatically'''
for name, attr in inspect.getmembers(self):
if isinstance(attr, commands.Command):
self.add_command(attr)
```
When iterating through this custom client's it accesses the latencies property when no shards are ready, therefore it raises the error. A quick fix for this would be to return None if no shards are ready.
Diffstat (limited to 'docs/api.rst')
0 files changed, 0 insertions, 0 deletions