From ab39c111eb6f34caa37d7d7209cba31d218d2402 Mon Sep 17 00:00:00 2001 From: profitroll Date: Mon, 14 Aug 2023 15:22:00 +0200 Subject: [PATCH] Small config reading fix --- modules/database.py | 12 ++---------- requirements.txt | 1 - 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/modules/database.py b/modules/database.py index ac8a6e7..feb7688 100644 --- a/modules/database.py +++ b/modules/database.py @@ -1,11 +1,9 @@ """Module that provides all database columns""" from async_pymongo import AsyncClient -from ujson import loads +from libbot import sync -with open("config.json", "r", encoding="utf-8") as f: - db_config = loads(f.read())["database"] - f.close() +db_config = sync.config_get("database") if db_config["user"] is not None and db_config["password"] is not None: con_string = "mongodb://{0}:{1}@{2}:{3}/{4}".format( @@ -23,12 +21,6 @@ else: db_client = AsyncClient(con_string) db = db_client.get_database(name=db_config["name"]) -# collections = db.list_collection_names() - -# for collection in ["users", "groups", "schedule"]: -# if collection not in collections: -# db.create_collection(collection) - col_users = db.get_collection("users") col_groups = db.get_collection("groups") col_schedule = db.get_collection("schedule") diff --git a/requirements.txt b/requirements.txt index b327e3e..2c2f6bf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ -black~=23.7.0 Pillow~=10.0.0 pykeyboard==0.1.5 tgcrypto==1.2.5