bot: Send user message if no ssl found
All checks were successful
Build Docker / Build Docker (push) Successful in 16s

This commit is contained in:
Nathan Woodburn 2023-10-01 23:08:01 +11:00
parent b5df6efead
commit ae7d3e4d05
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

5
bot.py
View File

@ -334,6 +334,7 @@ async def checkForSSLExpiry():
for record in response: for record in response:
records.append(str(record)) records.append(str(record))
if not records: if not records:
print(f"No A record found for {domain}", flush=True)
continue continue
# Get the first A record # Get the first A record
ip = records[0] ip = records[0]
@ -366,6 +367,10 @@ async def checkForSSLExpiry():
if user: if user:
await user.send(f"SSL certificate for {domain} is valid") await user.send(f"SSL certificate for {domain} is valid")
print(f"SSL certificate for {domain} is valid", flush=True) print(f"SSL certificate for {domain} is valid", flush=True)
else:
print(f"No certificate found for {domain}", flush=True)
await user.send(f"No certificate found for {domain}")
continue
except Exception as e: except Exception as e:
print(e, flush=True) print(e, flush=True)
log(e) log(e)