Skip to content

Commit

Permalink
fix: not being able to find who sent the CallbackQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
Itz-fork committed Jan 2, 2024
1 parent 1669524 commit 0dad204
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 4 additions & 1 deletion megadl/helpers/cypher.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
_emsg = """
##### Mega.nz-Bot Error Handler #####
Raised by: {}
Version: {}
Module: {}
Error:
Expand Down Expand Up @@ -178,7 +179,9 @@ async def cy_run(client: Client, msg: Message):
except Exception as e:
await self.cyeor(msg, f"**Oops 🫨, Somethig bad happend!** \n\n`{e}`")
await self.full_cleanup(f"{self.dl_loc}/{uid}", uid)
logging.warning(_emsg.format(self.version, func.__module__, e))
logging.warning(
_emsg.format(func.__name__, self.version, func.__module__, e)
)

return cy_run

Expand Down
3 changes: 2 additions & 1 deletion megadl/modules/mega_dl.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from os import path, makedirs

from pyrogram import filters
from pyrogram.enums import ChatType
from pyrogram.types import (
Message,
CallbackQuery,
Expand Down Expand Up @@ -49,7 +50,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.message.from_user.id
qusr = query.from_user.id
dtmp = client.glob_tmp.get(qusr)
url = dtmp[0]
dlid = dtmp[1]
Expand Down
4 changes: 2 additions & 2 deletions megadl/modules/mega_up.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ 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.message.from_user.id
qusr = query.from_user.id
msg = await client.get_messages(qcid, _mid)

# weird workaround to add support for private mode
conf = None
Expand All @@ -68,7 +69,6 @@ async def to_up_cb(client: CypherClient, query: CallbackQuery):
conf = f"--username {client.cipher.decrypt(udoc['email']).decode()} --password {client.cipher.decrypt(udoc['password']).decode()}"

strtim = time()
msg = await client.get_messages(qcid, _mid)
# Status msg
await query.edit_message_text("`Trying to download the file 📥`", reply_markup=None)
# update upload count
Expand Down

0 comments on commit 0dad204

Please sign in to comment.