This commit is contained in:
levina 2022-01-26 19:58:22 +07:00 committed by GitHub
parent 135b90b32d
commit 2045d422d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,5 @@
# credit to TeamYukki for this speedtest module # credit to TeamYukki for this speedtest module
import os import os
import wget import wget
import speedtest import speedtest
@ -15,19 +16,20 @@ from pyrogram.types import Message
@Client.on_message(command(["speedtest", f"speedtest@{bname}"]) & ~filters.edited) @Client.on_message(command(["speedtest", f"speedtest@{bname}"]) & ~filters.edited)
@sudo_users_only @sudo_users_only
async def run_speedtest(_, message: Message): async def run_speedtest(_, message: Message):
m = await message.reply_text("Running server speedtest -->") m = await message.reply_text("⚡️ running server speedtest")
try: try:
test = speedtest.Speedtest() test = speedtest.Speedtest()
test.get_best_server() test.get_best_server()
m = await m.edit("Running download speedtest --->") m = await m.edit("⚡️ running download speedtest..")
test.download() test.download()
m = await m.edit("Running upload speedtest ---->") m = await m.edit("⚡️ running upload speedtest...")
test.upload() test.upload()
test.results.share() test.results.share()
result = test.results.dict() result = test.results.dict()
except Exception as e: except Exception as e:
return await m.edit(e) await m.edit(e)
m = await m.edit("🔄 Sharing speedtest results") return
m = await m.edit("🔄 sharing speedtest results")
path = wget.download(result["share"]) path = wget.download(result["share"])
output = f"""💡 **SpeedTest Results** output = f"""💡 **SpeedTest Results**