Improve pingdc (#84)
All checks were successful
Docker Dev Build / docker build and publish (push) Successful in 6m26s

增强pingdc兼容性
This commit is contained in:
loneshore 2024-08-12 21:34:53 +08:00 committed by GitHub
parent e8fc72c9de
commit b8c54d0cce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -106,7 +106,7 @@ async def ping_dc(message: Message):
data.append("0")
else:
result = await execute(
f"ping -c 1 {DCs[dc]} | awk -F '/' " + "'END {print $5}'"
f"ping -c 1 {DCs[dc]} | awk -F 'time=' " + "'/time=/ {print $2}' | awk '{print $1}'"
)
try:
data.append(str(float(result)))