🐛 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)

View File

@ -4,6 +4,7 @@ import logging
import os
from .helperClasses import Options
logging.addLevelName(25, "PRINT")
logging.basicConfig(filename="gwendolyn.log", level=logging.INFO)
def getParams():
@ -33,7 +34,7 @@ def logThis(messages, channel : str = "", level : int = 20):
if len(messages) > 1:
messages[0] += " (details in log)"
if level != 10:
if level >= 25:
print(messages[0])
for logMessage in messages: