mirror of
https://github.com/Xtao-Labs/iShotaBot.git
synced 2024-11-16 04:35:55 +00:00
✨ 支持 Topic group
This commit is contained in:
parent
dd8aef67f5
commit
836ae880e6
10
init.py
10
init.py
@ -1,15 +1,16 @@
|
||||
import logging
|
||||
|
||||
import pyrogram
|
||||
import httpx
|
||||
|
||||
from models.sqlite import Sqlite
|
||||
from defs.glover import api_id, api_hash, ipv6
|
||||
from scheduler import scheduler
|
||||
from pyrogram import Client
|
||||
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,7 +37,10 @@ class UserMe:
|
||||
|
||||
user_me = UserMe()
|
||||
sqlite = Sqlite()
|
||||
bot = Client("bot", api_id=api_id, api_hash=api_hash, ipv6=ipv6, plugins=dict(root="modules"))
|
||||
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"
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ from sqlmodel import SQLModel
|
||||
from models.models.lofter import Lofter
|
||||
from models.models.fragment import Fragment
|
||||
|
||||
__all__ = ["Lofter", "Fragment"]
|
||||
__all__ = ["Lofter", "Fragment", "Sqlite"]
|
||||
|
||||
from sqlalchemy.ext.asyncio import create_async_engine
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
|
19
models/temp_fix.py
Normal file
19
models/temp_fix.py
Normal file
@ -0,0 +1,19 @@
|
||||
import pyrogram
|
||||
|
||||
|
||||
async def temp_fix(
|
||||
client: "pyrogram.Client",
|
||||
message: pyrogram.raw.base.Message,
|
||||
users: dict,
|
||||
chats: dict,
|
||||
is_scheduled: bool = False,
|
||||
replies: int = 1
|
||||
):
|
||||
parsed = await pyrogram.types.Message.old_parse(client, message, users, chats, is_scheduled, replies) # 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
|
@ -1,5 +1,5 @@
|
||||
pyrogram==2.0.59
|
||||
tgcrypto==1.2.4
|
||||
pyrogram==2.0.62
|
||||
tgcrypto==1.2.5
|
||||
httpx
|
||||
pillow
|
||||
cashews
|
||||
|
Loading…
Reference in New Issue
Block a user