ping.py 868 B

1234567891011121314151617181920212223
  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. ping1 = round(requests.head("https://cdn1.telesco.pe/").elapsed.total_seconds() * 1000)
  11. ping2 = round(requests.head("https://cdn2.telesco.pe/").elapsed.total_seconds() * 1000)
  12. ping3 = round(requests.head("https://cdn3.telesco.pe/").elapsed.total_seconds() * 1000)
  13. ping4 = round(requests.head("https://cdn4.telesco.pe/").elapsed.total_seconds() * 1000)
  14. ping5 = round(requests.head("https://cdn5.telesco.pe/").elapsed.total_seconds() * 1000)
  15. await message.reply_text(f'''
  16. ```DC1 - {ping1}ms
  17. DC2 - {ping2}ms
  18. DC3 - {ping3}ms
  19. DC4 - {ping4}ms
  20. DC5 - {ping5}ms```
  21. ''')