Files
TeleDiffusionBot/bot/modules/api/ping.py
2023-03-06 22:53:30 +02:00

15 lines
388 B
Python

import aiohttp
from bot.db import db, DBTables, decrypt
async def ping():
endpoint = decrypt(db[DBTables.config].get('endpoint'))
try:
async with aiohttp.ClientSession() as session:
r = await session.head(endpoint)
if r.status != 200:
return False
return True
except aiohttp.ClientConnectorError:
return False