fix: temp fix

This commit is contained in:
xtaodada 2024-11-15 21:17:32 +08:00
parent c6d04539ae
commit c20bce5105
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
3 changed files with 1 additions and 42 deletions

View File

@ -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"
}

View File

@ -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

View File

@ -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