bot: Check for user existance
All checks were successful
Build Docker / Build Docker (push) Successful in 16s

This commit is contained in:
Nathan Woodburn 2023-10-01 23:14:37 +11:00
parent 937606efaa
commit c67a914970
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

4
bot.py
View File

@ -363,12 +363,16 @@ async def checkForSSLExpiry():
if user: if user:
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:
print(f"User {userid} not found", flush=True)
else: else:
# Test by sending a message # Test by sending a message
user = client.get_user(int(userid)) user = client.get_user(int(userid))
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"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}")