🐛 Added some more logging for bug fixing

This commit is contained in:
NikolajDanger
2021-03-31 10:48:56 +02:00
parent 6c1a1cf626
commit c0ce8d03ff
4 changed files with 39 additions and 8 deletions

View File

@ -1,4 +1,4 @@
import re, git, os, json
import re, git, os, json, time
def sanitize(data : str, options : bool = False):
data = data.splitlines()
@ -130,3 +130,16 @@ class databaseFuncs():
return True, False, data["imdbNames"]
else:
return False, None, None
async def syncCommands(self):
collection = self.bot.database["last synced"]
lastSynced = collection.find_one()
now = time.time()
if lastSynced["last synced"] < now - 86400:
slashCommandList = str(await self.bot.slash.to_dict())
self.bot.log(f"Updating commands: {slashCommandList}")
await self.bot.slash.sync_all_commands()
idNumber = lastSynced["_id"]
queryFilter = {"_id" : idNumber}
update = {"$set" : {"last synced" : now}}
collection.update_one(queryFilter, update)