mirror of
https://github.com/TeamPGM/PagerMaid-Pyro.git
synced 2024-11-21 13:38:21 +00:00
🔖 Update to v1.4.8
This commit is contained in:
parent
3ddd16b744
commit
0e7379ecc8
@ -22,8 +22,8 @@ from pagermaid.scheduler import scheduler
|
||||
import pyromod.listen
|
||||
from pyrogram import Client
|
||||
|
||||
pgm_version = "1.4.7"
|
||||
pgm_version_code = 1407
|
||||
pgm_version = "1.4.8"
|
||||
pgm_version_code = 1408
|
||||
CMD_LIST = {}
|
||||
module_dir = __path__[0]
|
||||
working_dir = getcwd()
|
||||
|
@ -85,19 +85,22 @@ async def profile(client: Client, message: Message):
|
||||
f"{lang('profile_type')}: {user_type} \n"
|
||||
f"[{first_name}](tg://user?id={user.id})"
|
||||
)
|
||||
photo = await client.download_media(user.photo.big_file_id)
|
||||
photo = await client.download_media(user.photo.big_file_id) if user.photo else None
|
||||
reply_to = (
|
||||
message.reply_to_message.id
|
||||
if message.reply_to_message
|
||||
else message.reply_to_top_message_id
|
||||
else None
|
||||
)
|
||||
try:
|
||||
await client.send_photo(
|
||||
message.chat.id, photo, caption=caption, reply_to_message_id=reply_to
|
||||
)
|
||||
await message.delete()
|
||||
return remove(photo)
|
||||
except TypeError:
|
||||
if photo:
|
||||
try:
|
||||
await client.send_photo(
|
||||
message.chat.id, photo, caption=caption, reply_to_message_id=reply_to
|
||||
)
|
||||
await message.delete()
|
||||
return remove(photo)
|
||||
except TypeError:
|
||||
await message.edit(caption)
|
||||
else:
|
||||
await message.edit(caption)
|
||||
|
||||
|
||||
|
@ -169,29 +169,13 @@ async def re(bot: Client, message: Message):
|
||||
for _ in range(num):
|
||||
try:
|
||||
if not message.chat.has_protected_content:
|
||||
await forward_msg(bot, message.reply_to_message)
|
||||
await reply.forward(reply.chat.id, message_thread_id=reply.message_thread_id)
|
||||
else:
|
||||
await reply.copy(
|
||||
reply.chat.id,
|
||||
reply_to_message_id=message.reply_to_top_message_id,
|
||||
message_thread_id=message.message_thread_id,
|
||||
)
|
||||
except (Forbidden, FloodWait, Exception):
|
||||
return
|
||||
else:
|
||||
await message.edit(lang("not_reply"))
|
||||
|
||||
|
||||
async def forward_msg(bot: Client, message: Message):
|
||||
message_ids = [message.id]
|
||||
await bot.invoke(
|
||||
ForwardMessages(
|
||||
to_peer=await bot.resolve_peer(message.chat.id),
|
||||
from_peer=await bot.resolve_peer(message.chat.id),
|
||||
id=message_ids,
|
||||
silent=None,
|
||||
random_id=[bot.rnd_id() for _ in message_ids],
|
||||
schedule_date=None,
|
||||
noforwards=None,
|
||||
top_msg_id=message.reply_to_top_message_id,
|
||||
)
|
||||
)
|
||||
|
@ -181,6 +181,7 @@ async def plugin(message: Message):
|
||||
file_name,
|
||||
message.chat.id,
|
||||
reply_id,
|
||||
message_thread_id=message.message_thread_id,
|
||||
thumb=f"pagermaid{sep}assets{sep}logo.jpg",
|
||||
caption=f"<b>{lang('apt_name')}</b>\n\n"
|
||||
f"PagerMaid-Pyro {message.parameter[1]} plugin.",
|
||||
|
@ -26,9 +26,9 @@ async def prune(client: Client, message: Message):
|
||||
messages = []
|
||||
count = 0
|
||||
limit = message.id - message.reply_to_message.id + 1
|
||||
if message.reply_to_top_message_id:
|
||||
if message.message_thread_id:
|
||||
func = client.get_discussion_replies(
|
||||
input_chat, message.reply_to_top_message_id, limit=limit
|
||||
input_chat, message.message_thread_id, limit=limit
|
||||
)
|
||||
else:
|
||||
func = client.get_chat_history(input_chat, limit=limit)
|
||||
@ -185,5 +185,5 @@ async def send_prune_notify(bot: Client, message: Message, count_buffer, count):
|
||||
return await bot.send_message(
|
||||
message.chat.id,
|
||||
f"{lang('spn_deleted')} {str(count_buffer)} / {str(count)} {lang('prune_hint2')}",
|
||||
reply_to_message_id=message.reply_to_top_message_id,
|
||||
message_thread_id=message.message_thread_id,
|
||||
)
|
||||
|
@ -91,7 +91,8 @@ async def send_log(message: Message):
|
||||
await upload_attachment(
|
||||
"data/pagermaid.log.txt",
|
||||
message.chat.id,
|
||||
message.reply_to_message_id or message.reply_to_top_message_id,
|
||||
message.reply_to_message_id,
|
||||
message_thread_id=message.message_thread_id,
|
||||
thumb=f"pagermaid{sep}assets{sep}logo.jpg",
|
||||
caption=lang("send_log_caption"),
|
||||
)
|
||||
|
@ -19,6 +19,11 @@ __all__ = [
|
||||
"AlreadyInConversationError",
|
||||
"TimeoutConversationError",
|
||||
"ListenerCanceled",
|
||||
"get_sudo_list",
|
||||
"_status_sudo",
|
||||
"Message",
|
||||
"sqlite",
|
||||
"safe_remove",
|
||||
]
|
||||
# init folders
|
||||
if not exists("data"):
|
||||
|
@ -53,7 +53,7 @@ async def attach_log(plaintext, chat_id, file_name, reply_id=None, caption=None)
|
||||
remove(file_name)
|
||||
|
||||
|
||||
async def upload_attachment(file_path, chat_id, reply_id, caption=None, thumb=None):
|
||||
async def upload_attachment(file_path, chat_id, reply_id, message_thread_id=None, caption=None, thumb=None):
|
||||
"""Uploads a local attachment file."""
|
||||
if not exists(file_path):
|
||||
return False
|
||||
@ -61,6 +61,7 @@ async def upload_attachment(file_path, chat_id, reply_id, caption=None, thumb=No
|
||||
await bot.send_document(
|
||||
chat_id,
|
||||
file_path,
|
||||
message_thread_id=message_thread_id,
|
||||
thumb=thumb,
|
||||
reply_to_message_id=reply_id,
|
||||
caption=caption,
|
||||
|
@ -372,17 +372,6 @@ class Message(pyrogram.types.Message):
|
||||
parsed = await pyrogram.types.Message.old_parse(
|
||||
client, message, users, chats, is_scheduled, replies
|
||||
) # noqa
|
||||
# forum topic
|
||||
if isinstance(message, pyrogram.raw.types.Message):
|
||||
parsed.forum_topic = getattr(message.reply_to, "forum_topic", None)
|
||||
if (
|
||||
message.reply_to
|
||||
and parsed.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
|
||||
# make message.text as message.caption
|
||||
parsed.text = parsed.text or parsed.caption
|
||||
return parsed
|
||||
|
Loading…
Reference in New Issue
Block a user