Skip to content

Commit

Permalink
database: use query.message.from_user.id
Browse files Browse the repository at this point in the history
  • Loading branch information
Itz-fork committed Jan 2, 2024
1 parent b57f662 commit 1669524
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
12 changes: 2 additions & 10 deletions megadl/helpers/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,14 @@ async def plus_fl_count(
await self.mongoc.update_async(
self.coll_users,
{"_id": user_id},
[
{"$match": {"_id": user_id}},
{"$inc": {"total_downloads": downloads}},
{"$replaceWith": {"$mergeObjects": ["$$ROOT", "$$CURRENT"]}},
],
{"$inc": {"total_downloads": downloads}},
use_given=True,
)
elif uploads:
await self.mongoc.update_async(
self.coll_users,
{"_id": user_id},
[
{"$match": {"_id": user_id}},
{"$inc": {"total_uploads": uploads}},
{"$replaceWith": {"$mergeObjects": ["$$ROOT", "$$CURRENT"]}},
],
{"$inc": {"total_uploads": uploads}},
use_given=True,
)

Expand Down
2 changes: 1 addition & 1 deletion megadl/modules/mega_dl.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ async def dl_from_cb(client: CypherClient, query: CallbackQuery):
# Access saved info
_mid = int(query.data.split("-")[1])
qcid = query.message.chat.id
qusr = query.from_user.id
qusr = query.message.from_user.id
dtmp = client.glob_tmp.get(qusr)
url = dtmp[0]
dlid = dtmp[1]
Expand Down
2 changes: 1 addition & 1 deletion megadl/modules/mega_up.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async def to_up_cb(client: CypherClient, query: CallbackQuery):
_mid = int(query.data.split("-")[1])
qmid = query.message.id
qcid = query.message.chat.id
qusr = query.from_user.id
qusr = query.message.from_user.id

# weird workaround to add support for private mode
conf = None
Expand Down

0 comments on commit 1669524

Please sign in to comment.