diff --git a/bot/helper/ext_utils/database.py b/bot/helper/ext_utils/database.py index 013bec4c..4eccf76a 100644 --- a/bot/helper/ext_utils/database.py +++ b/bot/helper/ext_utils/database.py @@ -15,8 +15,8 @@ def __init__(self): def __connect(self): try: self.__client = MongoClient(DATABASE_URL) - self.__db = self.client['SearchX'] - self.__collection = self.db['users'] + self.__db = self.__client['SearchX'] + self.__collection = self.__db['users'] except PyMongoError as err: LOGGER.error(err) self.__err = True @@ -24,21 +24,21 @@ def __connect(self): def auth_user(self, user_id: int): if self.__err: return - self.col.insert_one({"user_id": user_id}) + self.__collection.insert_one({"user_id": user_id}) return 'Authorization granted' self.__client.close() def unauth_user(self, user_id: int): if self.__err: return - self.col.delete_many({"user_id": user_id}) + self.__collection.delete_many({"user_id": user_id}) return 'Authorization revoked' self.__client.close() def load_users(self): if self.__err: return - users = self.col.find().sort("user_id") + users = self.__collection.find().sort("user_id") for user in users: AUTHORIZED_USERS.add(user["user_id"]) self.__client.close()