2
0
mirror of https://github.com/Nick80835/microbot synced 2025-08-31 14:38:04 +00:00

remove speed and ping

This commit is contained in:
Nick80835
2020-03-01 21:03:27 -05:00
parent 88bd0d2ea2
commit 63e546d6b5
2 changed files with 0 additions and 39 deletions

View File

@@ -17,43 +17,12 @@ import inspect
import io
from PIL import Image
from speedtest import Speedtest
from ubot.micro_bot import micro_bot
ldr = micro_bot.loader
@ldr.add(pattern="speed")
async def iamspeed(event):
test_message = await event.reply("`Running speed test…`")
test = Speedtest()
test.get_best_server()
test.download()
test.upload()
test.results.share()
result = test.results.dict()
await test_message.edit(
f"`Started at: {result['timestamp']}\n"
f"Download: {speed_convert(result['download'])}\n"
f"Upload: {speed_convert(result['upload'])}\n"
f"Ping: {result['ping']} milliseconds\n"
f"ISP: {result['client']['isp']}`"
)
def speed_convert(size):
power = 2**10
zero = 0
units = {0: '', 1: 'Kilobits/s', 2: 'Megabits/s', 3: 'Gigabits/s', 4: 'Terabits/s'}
while size > power:
size /= power
zero += 1
return f"{round(size, 2)} {units[zero]}"
@ldr.add(pattern="chatid")
async def chatidgetter(event):
if event.is_reply: