bot: Async the ssl check function
All checks were successful
Build Docker / Build Docker (push) Successful in 16s
All checks were successful
Build Docker / Build Docker (push) Successful in 16s
This commit is contained in:
parent
de5c8787ba
commit
0ac3b1592b
6
bot.py
6
bot.py
@ -316,7 +316,7 @@ def updateStatus():
|
||||
activity=discord.Activity(type=discord.ActivityType.watching, name=activityMessage)
|
||||
client.loop.create_task(client.change_presence(activity=activity))
|
||||
|
||||
def checkForSSLExpiry():
|
||||
async def checkForSSLExpiry():
|
||||
with open("/mnt/sslnotify.txt", "r") as file:
|
||||
lines = file.readlines()
|
||||
for line in lines:
|
||||
@ -358,12 +358,12 @@ def checkForSSLExpiry():
|
||||
if expiry_date < datetime.datetime.now() + datetime.timedelta(days=7):
|
||||
user = client.get_user(int(userid))
|
||||
if user:
|
||||
user.send(f"SSL certificate for {domain} expires soon")
|
||||
await user.send(f"SSL certificate for {domain} expires soon")
|
||||
else:
|
||||
# Test by sending a message
|
||||
user = client.get_user(int(userid))
|
||||
if user:
|
||||
user.send(f"SSL certificate for {domain} is valid")
|
||||
await user.send(f"SSL certificate for {domain} is valid")
|
||||
except Exception as e:
|
||||
print(e, flush=True)
|
||||
continue
|
||||
|
Loading…
Reference in New Issue
Block a user