diff options
author | 2021-05-09 21:08:49 +0300 | |
---|---|---|
committer | 2021-05-09 21:08:49 +0300 | |
commit | 62ce85f5d395135dfc1235775b4498813ab8cbc7 (patch) | |
tree | 72c1968c38364a64deb816498d9972c78b27ba7c | |
parent | Merge pull request #1564 from Shivansh-007/enhancement/ban (diff) |
Fixes Site Ping On Localhost
Improves parsing of site URL, so the ping command works locally and in
prod.
Signed-off-by: Hassan Abouelela <[email protected]>
-rw-r--r-- | bot/exts/utils/ping.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/bot/exts/utils/ping.py b/bot/exts/utils/ping.py index 572fc934b..6e6603ff4 100644 --- a/bot/exts/utils/ping.py +++ b/bot/exts/utils/ping.py @@ -1,4 +1,5 @@ import socket +import urllib.parse from datetime import datetime import aioping @@ -37,7 +38,8 @@ class Latency(commands.Cog): bot_ping = f"{bot_ping:.{ROUND_LATENCY}f} ms" try: - delay = await aioping.ping(URLs.site, family=socket.AddressFamily.AF_INET) * 1000 + url = urllib.parse.urlparse(URLs.site_schema + URLs.site).hostname + delay = await aioping.ping(url, family=socket.AddressFamily.AF_INET) * 1000 site_ping = f"{delay:.{ROUND_LATENCY}f} ms" except TimeoutError: |