import time import pathlib import toml class ConfigFile(): def __init__(self, path): self.path = pathlib.Path(path) if self.path.exists() == 0: self.path.touch() self.data = dict() with open(self.path, 'r') as f: self.data = toml.load(f) def modify(self, key, value): self.data[key] = value self.save() def save(self, path=""): if path == "": path = self.path with open(path, 'w') as f: toml.dump(self.data, f) def get(self, key, default = None): return self.data.get(key, default) def get_daystamp() -> int: config = ConfigFile("config.toml") time_override = config.get("time_override", -1) if time_override is not None and time_override != -1: #print(f"TIME OVERRIDEED TO {time_override}") return int(time_override) return int(time.time() // (24 * 3600))