ping.py 584 B

123456789101112131415161718
  1. from wbb import app
  2. from wbb.utils import cust_filter
  3. import requests
  4. __MODULE__ = "Ping"
  5. __HELP__ = " /ping - To Get Response Time From All TG Datacenters"
  6. @app.on_message(cust_filter.command(commands=("ping")))
  7. async def ping(client, message):
  8. app.set_parse_mode("markdown")
  9. m = await message.reply_text("```Wait, Pinging all Datacenters```")
  10. result = ""
  11. for i in range(1, 6):
  12. dc = (f"https://cdn{i}.telesco.pe")
  13. ping1 = round(requests.head(dc).elapsed.total_seconds() * 1000)
  14. result += f'```DC{i} - {ping1}ms```'
  15. await m.edit(result)