Skip to content

Commit

Permalink
Speedtest Fixed !!!
Browse files Browse the repository at this point in the history
  • Loading branch information
KSKOP69 committed Nov 8, 2024
1 parent 3203226 commit 2096503
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions AlexaMusic/plugins/tools/speedtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,39 +21,39 @@
SPEEDTEST_COMMAND = get_command("SPEEDTEST_COMMAND")


def testspeed(m):
async def testspeed(m):
try:
test = speedtest.Speedtest()
test.get_best_server()
m = m.edit("🙄 ᴄʜᴇᴄᴋɪɴɢ ᴅᴏᴡɴʟᴏᴀᴅ sᴩᴇᴇᴅ...")
await m.edit("<b>⇆ 𝖱𝗎𝗇𝗇𝗂𝗇𝗀 𝖣𝗈𝗐𝗅𝗈𝖺𝖽 𝖲𝗉𝖾𝖾𝖽𝖳𝖾𝗌𝗍 ...</b>")
test.download()
m = m.edit("🙄 ᴄʜᴇᴄᴋɪɴɢ ᴜᴩʟᴏᴀᴅ sᴩᴇᴇᴅ...")
await m.edit("<b>⇆ 𝖱𝗎𝗇𝗇𝗂𝗇𝗀 𝖴𝗉𝗅𝗈𝖺𝖽 𝖲𝗉𝖾𝖾𝖽𝖳𝖾𝗌𝗍 ...</b>")
test.upload()
test.results.share()
result = test.results.dict()
m = m.edit("😴 ᴜᴩʟᴏᴀᴅɪɴɢ sᴩᴇᴇᴅᴛᴇsᴛ ʀᴇsᴜʟᴛs...")
await m.edit("<b>↻ 𝖲𝗁𝖺𝗋𝗂𝗇𝗀 𝖲𝗉𝖾𝖾𝖽𝖳𝖾𝗌𝗍 𝖱𝖾𝗌𝗎𝗅𝗍𝗌 ...</b>")
except Exception as e:
return m.edit(e)
return await m.edit(str(e))
return result


@app.on_message(filters.command(SPEEDTEST_COMMAND) & SUDOERS)
async def speedtest_function(client, message):
m = await message.reply_text("💫 ᴛʀʏɪɴɢ ᴛᴏ ᴄʜᴇᴄᴋ ᴜᴩʟᴏᴀᴅ ᴀɴᴅ ᴅᴏᴡɴʟᴏᴀᴅ sᴩᴇᴇᴅ")
loop = asyncio.get_event_loop()
result = await loop.run_in_executor(None, testspeed, m)
output = f"""**sᴩᴇᴇᴅᴛᴇsᴛ ʀᴇsᴜʟᴛs**
<u>**ᴄʟɪᴇɴᴛ:**</u>
**__ɪsᴩ:__** {result['client']['isp']}
**__ᴄᴏᴜɴᴛʀʏ:__** {result['client']['country']}
<u>**sᴇʀᴠᴇʀ:**</u>
**__ɴᴀᴍᴇ:__** {result['server']['name']}
**__ᴄᴏᴜɴᴛʀʏ:__** {result['server']['country']}, {result['server']['cc']}
**__sᴩᴏɴsᴏʀ:__** {result['server']['sponsor']}
**__ʟᴀᴛᴇɴᴄʏ:__** {result['server']['latency']}
**__ᴩɪɴɢ:__** {result['ping']}"""
m = await message.reply_text("» 𝖱𝗎𝗇𝗇𝗂𝗇𝗀 𝖠 𝖲𝗉𝖾𝖾𝖽𝖳𝖾𝗌𝗍 ...")
result = await testspeed(m)
output = f"""✯ <b>𝖲𝗉𝖾𝖾𝖽𝖳𝖾𝗌𝗍 𝖱𝖾𝗌𝗎𝗅𝗍𝗌</b> ✯
<u><b>𝖢𝗅𝗂𝖾𝗇𝗍 :</b></u>
<b>» 𝖨𝖲𝖯 :</b> {result['client']['isp']}
<b>» 𝖢𝗈𝗎𝗇𝗍𝗋𝗒 :</b> {result['client']['country']}
<u><b>𝖲𝖾𝗋𝗏𝖾𝗋 :</b></u>
<b>» 𝖭𝖺𝗆𝖾 :</b> {result['server']['name']}
<b>» 𝖢𝗈𝗎𝗇𝗍𝗋𝗒 :</b> {result['server']['country']}, {result['server']['cc']}
<b>» 𝖲𝗉𝗈𝗇𝗌𝗈𝗋 :</b> {result['server']['sponsor']}
<b>» 𝖫𝖺𝗍𝖾𝗇𝖼𝗒 :</b> {result['server']['latency']}
<b>» 𝖯𝗂𝗇𝗀 :</b> {result['ping']}
"""
msg = await app.send_photo(
chat_id=message.chat.id, photo=result["share"], caption=output
)
Expand Down

0 comments on commit 2096503

Please sign in to comment.