From 0dad2046393d42148bb1ff3edf62854d7c9a5354 Mon Sep 17 00:00:00 2001 From: Itz-fork Date: Tue, 2 Jan 2024 16:19:31 +0530 Subject: [PATCH] fix: not being able to find who sent the CallbackQuery --- megadl/helpers/cypher.py | 5 ++++- megadl/modules/mega_dl.py | 3 ++- megadl/modules/mega_up.py | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/megadl/helpers/cypher.py b/megadl/helpers/cypher.py index 606c86b6..6bfe97ea 100644 --- a/megadl/helpers/cypher.py +++ b/megadl/helpers/cypher.py @@ -23,6 +23,7 @@ _emsg = """ ##### Mega.nz-Bot Error Handler ##### +Raised by: {} Version: {} Module: {} Error: @@ -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 diff --git a/megadl/modules/mega_dl.py b/megadl/modules/mega_dl.py index d344b0b4..4af33e80 100644 --- a/megadl/modules/mega_dl.py +++ b/megadl/modules/mega_dl.py @@ -8,6 +8,7 @@ from os import path, makedirs from pyrogram import filters +from pyrogram.enums import ChatType from pyrogram.types import ( Message, CallbackQuery, @@ -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] diff --git a/megadl/modules/mega_up.py b/megadl/modules/mega_up.py index 9c4a9894..f92f3611 100644 --- a/megadl/modules/mega_up.py +++ b/megadl/modules/mega_up.py @@ -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 @@ -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