speed_test 修复问题

This commit is contained in:
xtaodada 2022-07-17 19:06:05 +08:00
parent 1a13ed75d5
commit cf783ebce5
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
2 changed files with 8 additions and 5 deletions

View File

@ -342,7 +342,7 @@
},
{
"name": "speed_test",
"version": "1.002",
"version": "1.003",
"section": "chat",
"maintainer": "xtaodada",
"size": "3.02 kb",

View File

@ -34,10 +34,13 @@ def unit_convert(byte):
async def run_speedtest(message: Message):
test = Speedtest()
server = [int(message.arguments)] if len(message.parameter) == 1 else []
server = int(message.arguments) if len(message.parameter) == 1 else None
if server:
test.get_servers(servers=server)
else:
servers = test.get_closest_servers()
for i in servers:
if i["id"] == str(server):
test.servers = i
break
test.get_best_server(servers=test.servers)
test.download()
test.upload()