ping.py 603 B

1234567891011121314151617181920
  1. from wbb import app
  2. import time
  3. from wbb.utils import cust_filter
  4. import requests
  5. import inspect
  6. __MODULE__ = "Ping"
  7. __HELP__ = " - /ping - to check if I am Alive or Not"
  8. @app.on_message(cust_filter.command(commands=(["ping"])))
  9. async def ping(client, message):
  10. app.set_parse_mode("markdown")
  11. m = await message.reply_text("```Wait, Pinging all Datacenters```")
  12. result = ""
  13. for i in range(1, 6):
  14. dc = (f"https://cdn{i}.telesco.pe")
  15. ping1 = round(requests.head(dc).elapsed.total_seconds() * 1000)
  16. result += f'```DC{i} - {ping1}ms```'
  17. await m.edit(result)