From 879348ad73f7466681df36af6ccc3fef8dd3a3f1 Mon Sep 17 00:00:00 2001 From: rk-shaju <124046085+rk-shaju@users.noreply.github.com> Date: Sun, 11 Aug 2024 12:45:55 +0600 Subject: [PATCH] Minor (#68) Fix missing bot_id in db for user settings. --- bot/helper/ext_utils/db_handler.py | 8 ++++---- bot/helper/z_utils.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bot/helper/ext_utils/db_handler.py b/bot/helper/ext_utils/db_handler.py index 20376cccc981..9937c20b6dcc 100644 --- a/bot/helper/ext_utils/db_handler.py +++ b/bot/helper/ext_utils/db_handler.py @@ -76,8 +76,8 @@ async def db_load(self): upsert=True ) # User Data - if await self._db.users.find_one(): # type: ignore - rows = self._db.users.find({}) # type: ignore + if await self._db.users[bot_id].find_one(): # type: ignore + rows = self._db.users[bot_id].find({}) # type: ignore # return a dict ==> {_id, is_sudo, is_auth, as_doc, thumb, yt_opt, media_group, equal_splits, split_size, rclone, rclone_path, token_pickle, gdrive_id, leech_dest, lperfix, lprefix, excluded_extensions, user_transmission, index_url, default_upload} async for row in rows: uid = row["_id"] @@ -218,7 +218,7 @@ async def update_user_data(self, user_id): del data["rclone_config"] if data.get("token_pickle"): del data["token_pickle"] - await self._db.users.replace_one( # type: ignore + await self._db.users[bot_id].replace_one( # type: ignore {"_id": user_id}, data, upsert=True @@ -236,7 +236,7 @@ async def update_user_doc(self, user_id, key, path=""): doc_bin = await doc.read() else: doc_bin = "" - await self._db.users.update_one( # type: ignore + await self._db.users[bot_id].update_one( # type: ignore {"_id": user_id}, {"$set": {key: doc_bin}}, upsert=True diff --git a/bot/helper/z_utils.py b/bot/helper/z_utils.py index 99c476606949..162462d58666 100644 --- a/bot/helper/z_utils.py +++ b/bot/helper/z_utils.py @@ -53,7 +53,7 @@ async def extract_link(link, shouldDel=False): link ).group(0).lower() # type: ignore elif is_gdrive_link(link): - raw_link = GoogleDriveHelper.getIdFromUrl(link) # type: ignore + raw_link = GoogleDriveHelper().getIdFromUrl(link) # type: ignore elif path.exists(link): if link.endswith(".nzb"): tree = ET.parse(link)