Skip to content

Commit

Permalink
Minor (#68)
Browse files Browse the repository at this point in the history
Fix missing bot_id in db for user settings.
  • Loading branch information
rk-shaju authored Aug 11, 2024
1 parent 68e21cf commit 879348a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions bot/helper/ext_utils/db_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion bot/helper/z_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 879348a

Please sign in to comment.