diff options
author | 2021-05-09 21:09:37 +0300 | |
---|---|---|
committer | 2021-05-09 21:11:46 +0300 | |
commit | a39b8a860b263046e07884b56e3937916abeb1d1 (patch) | |
tree | 419e527b3fe9cd10c52ae5f778c811807a15847f | |
parent | Fixes Site Ping On Localhost (diff) |
Adds Warning For Desynced Clock In Ping Command
Signed-off-by: Hassan Abouelela <[email protected]>
-rw-r--r-- | bot/exts/utils/ping.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/bot/exts/utils/ping.py b/bot/exts/utils/ping.py index 6e6603ff4..95490d5a9 100644 --- a/bot/exts/utils/ping.py +++ b/bot/exts/utils/ping.py @@ -35,7 +35,10 @@ class Latency(commands.Cog): # datetime.datetime objects do not have the "milliseconds" attribute. # It must be converted to seconds before converting to milliseconds. bot_ping = (datetime.utcnow() - ctx.message.created_at).total_seconds() * 1000 - bot_ping = f"{bot_ping:.{ROUND_LATENCY}f} ms" + if bot_ping <= 0: + bot_ping = "Your clock is out of sync, could not calculate ping." + else: + bot_ping = f"{bot_ping:.{ROUND_LATENCY}f} ms" try: url = urllib.parse.urlparse(URLs.site_schema + URLs.site).hostname |