bot: Add check for expiry past
All checks were successful
Build Docker / Build Docker (push) Successful in 17s
All checks were successful
Build Docker / Build Docker (push) Successful in 17s
This commit is contained in:
parent
af3f2c49d2
commit
2f0ec449c8
10
bot.py
10
bot.py
@ -224,7 +224,15 @@ async def ssl(ctx, domain: str):
|
||||
domain_check = True
|
||||
|
||||
expiry_date = cert_obj.not_valid_after
|
||||
message = message + "\n## Certificate Expiry:\n" + str(expiry_date) + "\n"
|
||||
# Check if expiry date is past
|
||||
if expiry_date < datetime.datetime.now():
|
||||
message = message + "\n## Expiry Date:\n:x: Certificate has expired\n"
|
||||
elif expiry_date < datetime.datetime.now() + datetime.timedelta(days=7):
|
||||
message = message + "\n## Expiry Date:\n:warning: Certificate expires soon\n"
|
||||
else:
|
||||
message = message + "\n## Expiry Date:\n:white_check_mark: Certificate is valid\n"
|
||||
|
||||
message = message + expiry_date.strftime("%d %B %Y %H:%M:%S") + "\n"
|
||||
|
||||
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user