ping.py 923 B

123456789101112131415161718192021222324
  1. from wbb import app
  2. import time
  3. from wbb.utils import cust_filter
  4. import requests
  5. __MODULE__ = "Ping"
  6. __HELP__ = " - /ping - to check if I am Alive or Not"
  7. @app.on_message(cust_filter.command(commands=(["ping"])))
  8. async def ping(client, message):
  9. app.set_parse_mode("markdown")
  10. m = await message.reply_text("Wait, Pinging all Datacenters")
  11. ping1 = round(requests.head("https://cdn1.telesco.pe/").elapsed.total_seconds() * 1000)
  12. ping2 = round(requests.head("https://cdn2.telesco.pe/").elapsed.total_seconds() * 1000)
  13. ping3 = round(requests.head("https://cdn3.telesco.pe/").elapsed.total_seconds() * 1000)
  14. ping4 = round(requests.head("https://cdn4.telesco.pe/").elapsed.total_seconds() * 1000)
  15. ping5 = round(requests.head("https://cdn5.telesco.pe/").elapsed.total_seconds() * 1000)
  16. await m.edit(f'''
  17. ```DC1 - {ping1}ms
  18. DC2 - {ping2}ms
  19. DC3 - {ping3}ms
  20. DC4 - {ping4}ms
  21. DC5 - {ping5}ms```
  22. ''')