🐛 Fix speedtest error
This commit is contained in:
parent
6b2da9212d
commit
4b24523fd9
@ -260,9 +260,11 @@ async def speedtest(context):
|
|||||||
test.download()
|
test.download()
|
||||||
test.upload()
|
test.upload()
|
||||||
test.results.share()
|
test.results.share()
|
||||||
except (ShareResultsConnectFailure, ShareResultsSubmitFailure, RuntimeError) as e:
|
except (ShareResultsSubmitFailure, RuntimeError) as e:
|
||||||
await context.edit(lang('speedtest_ConnectFailure'))
|
await context.edit(lang('speedtest_ConnectFailure'))
|
||||||
return
|
return
|
||||||
|
except ShareResultsConnectFailure:
|
||||||
|
pass
|
||||||
result = test.results.dict()
|
result = test.results.dict()
|
||||||
des = (
|
des = (
|
||||||
f"**Speedtest** \n"
|
f"**Speedtest** \n"
|
||||||
@ -275,6 +277,7 @@ async def speedtest(context):
|
|||||||
f"Timestamp: `{result['timestamp']}`"
|
f"Timestamp: `{result['timestamp']}`"
|
||||||
)
|
)
|
||||||
# 开始处理图片
|
# 开始处理图片
|
||||||
|
if result['share']:
|
||||||
data = get(result['share']).content
|
data = get(result['share']).content
|
||||||
with open('speedtest.png', mode='wb') as f:
|
with open('speedtest.png', mode='wb') as f:
|
||||||
f.write(data)
|
f.write(data)
|
||||||
@ -293,6 +296,8 @@ async def speedtest(context):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
await context.delete()
|
await context.delete()
|
||||||
|
else:
|
||||||
|
await context.edit(des)
|
||||||
|
|
||||||
|
|
||||||
@listener(is_plugin=False, outgoing=True, command=alias_command("connection"),
|
@listener(is_plugin=False, outgoing=True, command=alias_command("connection"),
|
||||||
|
Loading…
Reference in New Issue
Block a user