bot: Disable DM for valid ssl cert
All checks were successful
Build Docker / Build Docker (push) Successful in 16s

This commit is contained in:
Nathan Woodburn 2023-10-01 23:28:11 +11:00
parent d89c051374
commit 31c0b0a4e8
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

12
bot.py
View File

@ -364,22 +364,14 @@ async def checkForSSLExpiry():
await user.send(f"SSL certificate for {domain} expires soon") await user.send(f"SSL certificate for {domain} expires soon")
print(f"SSL certificate for {domain} expires soon", flush=True) print(f"SSL certificate for {domain} expires soon", flush=True)
else: else:
print(f"User {userid} not found", flush=True) await log(f"User {userid} not found")
else:
# Test by sending a message
user = await client.fetch_user(int(userid))
if user:
await user.send(f"SSL certificate for {domain} is valid")
print(f"SSL certificate for {domain} is valid", flush=True)
else:
print(f"User {userid} not found", flush=True)
else: else:
print(f"No certificate found for {domain}", flush=True) print(f"No certificate found for {domain}", flush=True)
await user.send(f"No certificate found for {domain}") await user.send(f"No certificate found for {domain}")
continue continue
except Exception as e: except Exception as e:
print(e, flush=True) print(e, flush=True)
log(e) await log(e)
continue continue
print("SSL check complete", flush=True) print("SSL check complete", flush=True)