From c20bce51050387fc78945fc5995e30c441adbf2f Mon Sep 17 00:00:00 2001 From: xtaodada Date: Fri, 15 Nov 2024 21:17:32 +0800 Subject: [PATCH] fix: temp fix --- init.py | 5 ----- models/temp_fix.py | 36 ------------------------------------ requirements.txt | 2 +- 3 files changed, 1 insertion(+), 42 deletions(-) delete mode 100644 models/temp_fix.py diff --git a/init.py b/init.py index caa9a43..090157e 100644 --- a/init.py +++ b/init.py @@ -9,8 +9,6 @@ from logging import getLogger, INFO, ERROR, StreamHandler, basicConfig from coloredlogs import ColoredFormatter from cashews import cache -from models.temp_fix import temp_fix - # Config cache cache.setup("mem://") # Enable logging @@ -36,9 +34,6 @@ sqlite = Sqlite() bot = pyrogram.Client( "bot", api_id=api_id, api_hash=api_hash, ipv6=ipv6, plugins=dict(root="modules") ) -# temp fix topics group -setattr(pyrogram.types.Message, "old_parse", getattr(pyrogram.types.Message, "_parse")) -setattr(pyrogram.types.Message, "_parse", temp_fix) headers = { "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.72 Safari/537.36" } diff --git a/models/temp_fix.py b/models/temp_fix.py deleted file mode 100644 index 99b3ad8..0000000 --- a/models/temp_fix.py +++ /dev/null @@ -1,36 +0,0 @@ -import pyrogram - - -async def temp_fix( - client: "pyrogram.Client", - message: pyrogram.raw.base.Message, - users: dict, - chats: dict, - topics: dict = None, - is_scheduled: bool = False, - replies: int = 1, - business_connection_id: str = None, - reply_to_message: "raw.base.Message" = None, -): - parsed = await pyrogram.types.Message.old_parse( - client, - message, - users, - chats, - topics, - is_scheduled, - replies, - business_connection_id, - reply_to_message, - ) # noqa - if ( - isinstance(message, pyrogram.raw.types.Message) - and message.reply_to - and hasattr(message.reply_to, "forum_topic") - and message.reply_to.forum_topic - and not message.reply_to.reply_to_top_id - ): - parsed.reply_to_top_message_id = parsed.reply_to_message_id - parsed.reply_to_message_id = None - parsed.reply_to_message = None - return parsed diff --git a/requirements.txt b/requirements.txt index ec499c1..eac6766 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -pyrogram==2.0.106 +git+https://github.com/TeamPGM/pyrogram tgcrypto==1.2.5 bilibili-api-python==16.2.1 httpx