mirror of
https://github.com/TeamPGM/PagerMaid_Plugins_Pyro.git
synced 2024-11-22 01:15:34 +00:00
all Update to v1.4.8
This commit is contained in:
parent
0d7b581d91
commit
cdca0354ae
@ -43,9 +43,9 @@ async def get_hitokoto(request: AsyncClient):
|
|||||||
try:
|
try:
|
||||||
htk = (await request.get("https://v1.hitokoto.cn/?charset=utf-8")).json()
|
htk = (await request.get("https://v1.hitokoto.cn/?charset=utf-8")).json()
|
||||||
text = f"\"{htk['hitokoto']}\" —— "
|
text = f"\"{htk['hitokoto']}\" —— "
|
||||||
if htk['from_who']:
|
if htk["from_who"]:
|
||||||
text += f"{htk['from_who']}"
|
text += f"{htk['from_who']}"
|
||||||
if htk['from']:
|
if htk["from"]:
|
||||||
text += f"「{htk['from']}」"
|
text += f"「{htk['from']}」"
|
||||||
except Exception:
|
except Exception:
|
||||||
text = '"用代码表达言语的魅力,用代码书写山河的壮丽。" —— 一言「一言开发者中心」'
|
text = '"用代码表达言语的魅力,用代码书写山河的壮丽。" —— 一言「一言开发者中心」'
|
||||||
|
@ -24,7 +24,7 @@ async def at_admins(client: Client, message: Message):
|
|||||||
await client.send_message(
|
await client.send_message(
|
||||||
message.chat.id,
|
message.chat.id,
|
||||||
"%s:\n\n%s" % (say, send_list),
|
"%s:\n\n%s" % (say, send_list),
|
||||||
reply_to_message_id=message.reply_to_message_id
|
reply_to_message_id=message.reply_to_message_id,
|
||||||
or message.reply_to_top_message_id,
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
await message.safe_delete()
|
await message.safe_delete()
|
||||||
|
@ -23,7 +23,8 @@ async def audio_to_voice(bot: Client, message: Message):
|
|||||||
audio,
|
audio,
|
||||||
reply_to_message_id=message.id
|
reply_to_message_id=message.id
|
||||||
if message.audio
|
if message.audio
|
||||||
else (message.reply_to_message_id or message.reply_to_top_message_id),
|
else message.reply_to_message_id,
|
||||||
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
await message.edit(f"转换为语音消息失败:{e}")
|
await message.edit(f"转换为语音消息失败:{e}")
|
||||||
|
@ -40,14 +40,14 @@ async def bingwall(message: Message):
|
|||||||
filename,
|
filename,
|
||||||
caption=f"#bing wallpaper\n" f"{str(copy_right)}",
|
caption=f"#bing wallpaper\n" f"{str(copy_right)}",
|
||||||
quote=False,
|
quote=False,
|
||||||
reply_to_message_id=message.reply_to_top_message_id,
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
await message.reply_photo(
|
await message.reply_photo(
|
||||||
filename,
|
filename,
|
||||||
caption=f"#bing wallpaper\n" f"{str(copy_right)}",
|
caption=f"#bing wallpaper\n" f"{str(copy_right)}",
|
||||||
quote=False,
|
quote=False,
|
||||||
reply_to_message_id=message.reply_to_top_message_id,
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
status = True
|
status = True
|
||||||
break # 成功了就赶紧结束啦!
|
break # 成功了就赶紧结束啦!
|
||||||
|
@ -79,7 +79,7 @@ async def chat_transfer(message: Message):
|
|||||||
"chats.csv",
|
"chats.csv",
|
||||||
caption=f"对话导出文件,成功导出了 {num} 个群组/频道",
|
caption=f"对话导出文件,成功导出了 {num} 个群组/频道",
|
||||||
thumb=f"pagermaid{sep}assets{sep}logo.jpg",
|
thumb=f"pagermaid{sep}assets{sep}logo.jpg",
|
||||||
reply_to_message_id=message.reply_to_top_message_id,
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
safe_remove("chats.csv")
|
safe_remove("chats.csv")
|
||||||
await message.safe_delete()
|
await message.safe_delete()
|
||||||
|
@ -487,7 +487,7 @@ async def eat(client_: Client, context: Message):
|
|||||||
await client_.send_document(
|
await client_.send_document(
|
||||||
context.chat.id,
|
context.chat.id,
|
||||||
f"plugins{sep}eat{sep}eat.webp",
|
f"plugins{sep}eat{sep}eat.webp",
|
||||||
reply_to_message_id=context.reply_to_top_message_id,
|
message_thread_id=context.message_thread_id,
|
||||||
)
|
)
|
||||||
await final_msg.safe_delete()
|
await final_msg.safe_delete()
|
||||||
except TypeError:
|
except TypeError:
|
||||||
|
@ -115,7 +115,7 @@ async def emoji_transfer(message: Message):
|
|||||||
"emojis.csv",
|
"emojis.csv",
|
||||||
caption=f"Emoji 包导出文件,成功导出了 {num} 个 Emoji 包",
|
caption=f"Emoji 包导出文件,成功导出了 {num} 个 Emoji 包",
|
||||||
thumb=f"pagermaid{sep}assets{sep}logo.jpg",
|
thumb=f"pagermaid{sep}assets{sep}logo.jpg",
|
||||||
reply_to_message_id=message.reply_to_top_message_id,
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
safe_remove("emojis.csv")
|
safe_remove("emojis.csv")
|
||||||
await message.safe_delete()
|
await message.safe_delete()
|
||||||
|
@ -120,13 +120,13 @@ async def epic(message: Message):
|
|||||||
"epic.jpg",
|
"epic.jpg",
|
||||||
caption=msg,
|
caption=msg,
|
||||||
quote=False,
|
quote=False,
|
||||||
reply_to_message_id=message.reply_to_top_message_id,
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
await message.reply(
|
await message.reply(
|
||||||
msg,
|
msg,
|
||||||
quote=False,
|
quote=False,
|
||||||
reply_to_message_id=message.reply_to_top_message_id,
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
safe_remove("epic.jpg")
|
safe_remove("epic.jpg")
|
||||||
else:
|
else:
|
||||||
|
@ -85,8 +85,8 @@ async def upload_sticker(bot: Client, message: Message, sticker_set: StickerSet)
|
|||||||
message.chat.id,
|
message.chat.id,
|
||||||
f"{directory_name}.zip",
|
f"{directory_name}.zip",
|
||||||
caption=sticker_set.set.short_name,
|
caption=sticker_set.set.short_name,
|
||||||
reply_to_message_id=message.reply_to_message_id
|
reply_to_message_id=message.reply_to_message_id,
|
||||||
or message.reply_to_top_message_id,
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
safe_remove(f"{directory_name}.zip")
|
safe_remove(f"{directory_name}.zip")
|
||||||
shutil.rmtree(directory_name)
|
shutil.rmtree(directory_name)
|
||||||
|
@ -20,10 +20,9 @@ async def httpcat(client: Client, message: Message, request: AsyncClient):
|
|||||||
await client.send_photo(
|
await client.send_photo(
|
||||||
message.chat.id,
|
message.chat.id,
|
||||||
io,
|
io,
|
||||||
reply_to_message_id=(
|
reply_to_message_id=message.reply_to_message_id
|
||||||
message.reply_to_message_id or message.reply_to_top_message_id
|
|
||||||
)
|
|
||||||
if message.outgoing
|
if message.outgoing
|
||||||
else message.id,
|
else message.id,
|
||||||
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
await message.safe_delete()
|
await message.safe_delete()
|
||||||
|
@ -133,7 +133,7 @@ async def jikipedia(message: Message):
|
|||||||
image,
|
image,
|
||||||
quote=False,
|
quote=False,
|
||||||
caption=text,
|
caption=text,
|
||||||
reply_to_message_id=message.reply_to_top_message_id,
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
await message.safe_delete()
|
await message.safe_delete()
|
||||||
except Exception:
|
except Exception:
|
||||||
|
@ -17,8 +17,8 @@ async def ju_pai(message: Message):
|
|||||||
await message.reply_photo(
|
await message.reply_photo(
|
||||||
image_url,
|
image_url,
|
||||||
quote=False,
|
quote=False,
|
||||||
reply_to_message_id=message.reply_to_message_id
|
reply_to_message_id=message.reply_to_message_id,
|
||||||
or message.reply_to_top_message_id,
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
await message.safe_delete()
|
await message.safe_delete()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -161,10 +161,13 @@ class KeywordTask:
|
|||||||
async def process_keyword(self, message: Message):
|
async def process_keyword(self, message: Message):
|
||||||
msg = None
|
msg = None
|
||||||
text = self.replace_reply(message)
|
text = self.replace_reply(message)
|
||||||
reply_id = message.id if self.reply else message.reply_to_top_message_id
|
reply_id = message.id if self.reply else None
|
||||||
with contextlib.suppress(Exception):
|
with contextlib.suppress(Exception):
|
||||||
msg = await message.reply(
|
msg = await message.reply(
|
||||||
text, parse_mode=ParseMode.HTML, reply_to_message_id=reply_id
|
text,
|
||||||
|
parse_mode=ParseMode.HTML,
|
||||||
|
reply_to_message_id=reply_id,
|
||||||
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
if self.delete:
|
if self.delete:
|
||||||
if self.source_delay_delete > 0:
|
if self.source_delay_delete > 0:
|
||||||
@ -236,10 +239,17 @@ class KeywordTask:
|
|||||||
|
|
||||||
if len(data) > 4:
|
if len(data) > 4:
|
||||||
self.delay_delete = int(data[4])
|
self.delay_delete = int(data[4])
|
||||||
if len(data) > 5: # assuming the source_delay_delete is the 6th part of the task format
|
if (
|
||||||
|
len(data) > 5
|
||||||
|
): # assuming the source_delay_delete is the 6th part of the task format
|
||||||
self.source_delay_delete = int(data[5])
|
self.source_delay_delete = int(data[5])
|
||||||
|
|
||||||
if self.ban < 0 or self.restrict < 0 or self.delay_delete < 0 or self.source_delay_delete < 0:
|
if (
|
||||||
|
self.ban < 0
|
||||||
|
or self.restrict < 0
|
||||||
|
or self.delay_delete < 0
|
||||||
|
or self.source_delay_delete < 0
|
||||||
|
):
|
||||||
raise ValueError("Invalid task format")
|
raise ValueError("Invalid task format")
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,8 +43,8 @@ async def netease_search(keyword: str, message: Message):
|
|||||||
await conv.mark_as_read()
|
await conv.mark_as_read()
|
||||||
await answer.copy(
|
await answer.copy(
|
||||||
message.chat.id,
|
message.chat.id,
|
||||||
reply_to_message_id=message.reply_to_message_id
|
reply_to_message_id=message.reply_to_message_id,
|
||||||
or message.reply_to_top_message_id,
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
await message.safe_delete()
|
await message.safe_delete()
|
||||||
|
|
||||||
@ -57,8 +57,8 @@ async def netease_url(url: str, message: Message):
|
|||||||
await conv.mark_as_read()
|
await conv.mark_as_read()
|
||||||
await answer.copy(
|
await answer.copy(
|
||||||
message.chat.id,
|
message.chat.id,
|
||||||
reply_to_message_id=message.reply_to_message_id
|
reply_to_message_id=message.reply_to_message_id,
|
||||||
or message.reply_to_top_message_id,
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
await message.safe_delete()
|
await message.safe_delete()
|
||||||
|
|
||||||
@ -71,8 +71,8 @@ async def netease_id(music_id: str, message: Message):
|
|||||||
await conv.mark_as_read()
|
await conv.mark_as_read()
|
||||||
await answer.copy(
|
await answer.copy(
|
||||||
message.chat.id,
|
message.chat.id,
|
||||||
reply_to_message_id=message.reply_to_message_id
|
reply_to_message_id=message.reply_to_message_id,
|
||||||
or message.reply_to_top_message_id,
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
await message.safe_delete()
|
await message.safe_delete()
|
||||||
|
|
||||||
|
@ -51,8 +51,6 @@ async def set_read_mentions(client: Client, message: Message):
|
|||||||
await client.invoke(
|
await client.invoke(
|
||||||
ReadMentions(
|
ReadMentions(
|
||||||
peer=await client.resolve_peer(message.chat.id),
|
peer=await client.resolve_peer(message.chat.id),
|
||||||
top_msg_id=message.reply_to_top_message_id
|
top_msg_id=message.message_thread_id if message.topic else None,
|
||||||
if message.chat.is_forum
|
|
||||||
else None,
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -285,14 +285,14 @@ async def send_illust(message: Message, illust: Illust) -> None:
|
|||||||
illust.image_urls["large"],
|
illust.image_urls["large"],
|
||||||
caption=caption,
|
caption=caption,
|
||||||
quote=False,
|
quote=False,
|
||||||
reply_to_message_id=message.reply_to_message_id
|
reply_to_message_id=message.reply_to_message_id,
|
||||||
or message.reply_to_top_message_id,
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
await message.reply_text(
|
await message.reply_text(
|
||||||
caption,
|
caption,
|
||||||
reply_to_message_id=message.reply_to_message_id
|
reply_to_message_id=message.reply_to_message_id,
|
||||||
or message.reply_to_top_message_id,
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -2104,7 +2104,11 @@ class MathChallenge(CaptchaChallenge):
|
|||||||
}
|
}
|
||||||
if previous_msg_id:
|
if previous_msg_id:
|
||||||
params["message_id"] = previous_msg_id
|
params["message_id"] = previous_msg_id
|
||||||
challenge_msg = await exec_api((bot.edit_message_text if previous_msg_id else bot.send_message)(**params))
|
challenge_msg = await exec_api(
|
||||||
|
(bot.edit_message_text if previous_msg_id else bot.send_message)(
|
||||||
|
**params
|
||||||
|
)
|
||||||
|
)
|
||||||
if not challenge_msg:
|
if not challenge_msg:
|
||||||
return await log(
|
return await log(
|
||||||
f"Failed to send math captcha challenge to {self.user.id}"
|
f"Failed to send math captcha challenge to {self.user.id}"
|
||||||
@ -2403,7 +2407,9 @@ class Rule:
|
|||||||
try:
|
try:
|
||||||
exec(f"async def _(msg, text, user, me, bot):\n return {custom_rule}")
|
exec(f"async def _(msg, text, user, me, bot):\n return {custom_rule}")
|
||||||
return bool(
|
return bool(
|
||||||
await locals()["_"](self.msg, self._get_text(), self.user, bot.me, bot)
|
await locals()["_"](
|
||||||
|
self.msg, self._get_text(), self.user, bot.me, bot
|
||||||
|
)
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
await log(
|
await log(
|
||||||
|
@ -35,8 +35,8 @@ async def qq_music(message: Message, client: AsyncClient):
|
|||||||
uri,
|
uri,
|
||||||
thumb=cover or None,
|
thumb=cover or None,
|
||||||
caption=f"{text}",
|
caption=f"{text}",
|
||||||
reply_to_message_id=message.reply_to_message_id
|
reply_to_message_id=message.reply_to_message_id,
|
||||||
or message.reply_to_top_message_id,
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
await msg.safe_delete()
|
await msg.safe_delete()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -34,8 +34,8 @@ async def gen_qr(client: Client, message: Message):
|
|||||||
await client.send_document(
|
await client.send_document(
|
||||||
message.chat.id,
|
message.chat.id,
|
||||||
document="qr.webp",
|
document="qr.webp",
|
||||||
reply_to_message_id=message.reply_to_message_id
|
reply_to_message_id=message.reply_to_message_id,
|
||||||
or message.reply_to_top_message_id,
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
except UnicodeEncodeError:
|
except UnicodeEncodeError:
|
||||||
await message.edit(f"{lang('error_prefix')}{lang('genqr_e_encode')}")
|
await message.edit(f"{lang('error_prefix')}{lang('genqr_e_encode')}")
|
||||||
|
@ -4,7 +4,11 @@ from typing import Dict, List
|
|||||||
from pyrogram import filters
|
from pyrogram import filters
|
||||||
from pyrogram.errors import ChatAdminRequired, UserAdminInvalid, FloodWait
|
from pyrogram.errors import ChatAdminRequired, UserAdminInvalid, FloodWait
|
||||||
from pyrogram.raw.functions.channels import GetAdminLog, GetMessages
|
from pyrogram.raw.functions.channels import GetAdminLog, GetMessages
|
||||||
from pyrogram.raw.types import ChannelAdminLogEventsFilter, ChannelAdminLogEventActionUpdatePinned, InputMessageID
|
from pyrogram.raw.types import (
|
||||||
|
ChannelAdminLogEventsFilter,
|
||||||
|
ChannelAdminLogEventActionUpdatePinned,
|
||||||
|
InputMessageID,
|
||||||
|
)
|
||||||
from pyrogram.raw.types.channels import AdminLogResults
|
from pyrogram.raw.types.channels import AdminLogResults
|
||||||
from pyrogram.raw.types.messages import Messages
|
from pyrogram.raw.types.messages import Messages
|
||||||
|
|
||||||
@ -49,7 +53,7 @@ async def try_ask_admin(message: Message, num_map: Dict[int, List[int]]) -> int:
|
|||||||
async with bot.conversation(
|
async with bot.conversation(
|
||||||
message.chat.id, filters=filters.user(message.from_user.id)
|
message.chat.id, filters=filters.user(message.from_user.id)
|
||||||
) as conv:
|
) as conv:
|
||||||
await sleep(.1)
|
await sleep(0.1)
|
||||||
res: Message = await conv.get_response()
|
res: Message = await conv.get_response()
|
||||||
await res.safe_delete()
|
await res.safe_delete()
|
||||||
uid = int(res.text)
|
uid = int(res.text)
|
||||||
@ -76,7 +80,9 @@ async def pin_one(message: Message, mid: int):
|
|||||||
|
|
||||||
async def get_unpin_messages(cid: int, ids: List[int]) -> List[int]:
|
async def get_unpin_messages(cid: int, ids: List[int]) -> List[int]:
|
||||||
ids = [InputMessageID(id=i) for i in ids]
|
ids = [InputMessageID(id=i) for i in ids]
|
||||||
r: Messages = await bot.invoke(GetMessages(channel=await bot.resolve_peer(cid), id=ids))
|
r: Messages = await bot.invoke(
|
||||||
|
GetMessages(channel=await bot.resolve_peer(cid), id=ids)
|
||||||
|
)
|
||||||
new_ids = []
|
new_ids = []
|
||||||
for i in r.messages:
|
for i in r.messages:
|
||||||
if not i.pinned:
|
if not i.pinned:
|
||||||
|
@ -27,7 +27,10 @@ def try_cast_or_fallback(val: Any, t: type) -> Any:
|
|||||||
|
|
||||||
|
|
||||||
def check_chat_available(chat: Chat):
|
def check_chat_available(chat: Chat):
|
||||||
assert (chat.type in [ChatType.CHANNEL, ChatType.GROUP] and not chat.has_protected_content)
|
assert (
|
||||||
|
chat.type in [ChatType.CHANNEL, ChatType.GROUP]
|
||||||
|
and not chat.has_protected_content
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@listener(
|
@listener(
|
||||||
@ -137,13 +140,21 @@ async def shift_set(client: Client, message: Message):
|
|||||||
await message.edit(f"备份频道 {source.id} 到 {target.id} 已完成。")
|
await message.edit(f"备份频道 {source.id} 到 {target.id} 已完成。")
|
||||||
# 列出要轉存的頻道
|
# 列出要轉存的頻道
|
||||||
elif message.parameter[0] == "list":
|
elif message.parameter[0] == "list":
|
||||||
from_ids = list(filter(lambda x: (x.startswith("shift.") and (not x.endswith("options"))), list(sqlite.keys())))
|
from_ids = list(
|
||||||
|
filter(
|
||||||
|
lambda x: (x.startswith("shift.") and (not x.endswith("options"))),
|
||||||
|
list(sqlite.keys()),
|
||||||
|
)
|
||||||
|
)
|
||||||
if not from_ids:
|
if not from_ids:
|
||||||
return await message.edit("沒有要轉存的頻道")
|
return await message.edit("沒有要轉存的頻道")
|
||||||
output = "總共有 %d 個頻道要轉存\n\n" % len(from_ids)
|
output = "總共有 %d 個頻道要轉存\n\n" % len(from_ids)
|
||||||
for from_id in from_ids:
|
for from_id in from_ids:
|
||||||
to_id = sqlite[from_id]
|
to_id = sqlite[from_id]
|
||||||
output += "%s -> %s\n" % (format_channel_id(from_id[6:]), format_channel_id(to_id))
|
output += "%s -> %s\n" % (
|
||||||
|
format_channel_id(from_id[6:]),
|
||||||
|
format_channel_id(to_id),
|
||||||
|
)
|
||||||
await message.edit(output)
|
await message.edit(output)
|
||||||
else:
|
else:
|
||||||
await message.edit(f"{lang('error_prefix')}{lang('arg_error')}")
|
await message.edit(f"{lang('error_prefix')}{lang('arg_error')}")
|
||||||
|
@ -118,8 +118,7 @@ async def speedtest(client: Client, message: Message, request: AsyncClient):
|
|||||||
message.chat.id,
|
message.chat.id,
|
||||||
photo,
|
photo,
|
||||||
caption=des,
|
caption=des,
|
||||||
reply_to_message_id=message.reply_to_top_message_id
|
message_thread_id=message.message_thread_id or message.reply_to_message_id,
|
||||||
or message.reply_to_message_id,
|
|
||||||
)
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
return await msg.edit(des)
|
return await msg.edit(des)
|
||||||
|
@ -118,7 +118,7 @@ async def sticker_transfer(message: Message):
|
|||||||
"stickers.csv",
|
"stickers.csv",
|
||||||
caption=f"贴纸包导出文件,成功导出了 {num} 个贴纸包",
|
caption=f"贴纸包导出文件,成功导出了 {num} 个贴纸包",
|
||||||
thumb=f"pagermaid{sep}assets{sep}logo.jpg",
|
thumb=f"pagermaid{sep}assets{sep}logo.jpg",
|
||||||
reply_to_message_id=message.reply_to_top_message_id,
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
safe_remove("stickers.csv")
|
safe_remove("stickers.csv")
|
||||||
await message.safe_delete()
|
await message.safe_delete()
|
||||||
|
@ -29,7 +29,7 @@ async def tg_bg(client: Client, message: Message):
|
|||||||
message.chat.id,
|
message.chat.id,
|
||||||
bg_doc.file_id,
|
bg_doc.file_id,
|
||||||
file_name="bg.jpg",
|
file_name="bg.jpg",
|
||||||
reply_to_message_id=message.reply_to_top_message_id,
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
return await message.safe_delete()
|
return await message.safe_delete()
|
||||||
await message.edit("获取失败,请检查 URL")
|
await message.edit("获取失败,请检查 URL")
|
||||||
|
16
vip/main.py
16
vip/main.py
@ -49,8 +49,8 @@ async def weather_pic(client: Client, message: Message):
|
|||||||
await conv.mark_as_read()
|
await conv.mark_as_read()
|
||||||
await answer.copy(
|
await answer.copy(
|
||||||
message.chat.id,
|
message.chat.id,
|
||||||
reply_to_message_id=message.reply_to_message_id
|
reply_to_message_id=message.reply_to_message_id,
|
||||||
or message.reply_to_top_message_id,
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
await message.safe_delete()
|
await message.safe_delete()
|
||||||
|
|
||||||
@ -67,8 +67,8 @@ async def weather_he(client: Client, message: Message):
|
|||||||
await conv.mark_as_read()
|
await conv.mark_as_read()
|
||||||
await answer.copy(
|
await answer.copy(
|
||||||
message.chat.id,
|
message.chat.id,
|
||||||
reply_to_message_id=message.reply_to_message_id
|
reply_to_message_id=message.reply_to_message_id,
|
||||||
or message.reply_to_top_message_id,
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
await message.safe_delete()
|
await message.safe_delete()
|
||||||
|
|
||||||
@ -82,8 +82,8 @@ async def az_tts(client: Client, message: Message, mode: str):
|
|||||||
await conv.mark_as_read()
|
await conv.mark_as_read()
|
||||||
await answer.copy(
|
await answer.copy(
|
||||||
message.chat.id,
|
message.chat.id,
|
||||||
reply_to_message_id=message.reply_to_message_id
|
reply_to_message_id=message.reply_to_message_id,
|
||||||
or message.reply_to_top_message_id,
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
await message.safe_delete()
|
await message.safe_delete()
|
||||||
|
|
||||||
@ -143,7 +143,7 @@ async def draw_photo(client: Client, message: Message):
|
|||||||
await conv.mark_as_read()
|
await conv.mark_as_read()
|
||||||
await answer.copy(
|
await answer.copy(
|
||||||
message.chat.id,
|
message.chat.id,
|
||||||
reply_to_message_id=message.reply_to_message_id
|
reply_to_message_id=message.reply_to_message_id,
|
||||||
or message.reply_to_top_message_id,
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
await message.safe_delete()
|
await message.safe_delete()
|
||||||
|
@ -17,8 +17,8 @@ async def weather_lite(request: AsyncClient, message: Message):
|
|||||||
f.write(data.content)
|
f.write(data.content)
|
||||||
await message.reply_photo(
|
await message.reply_photo(
|
||||||
"weather.png",
|
"weather.png",
|
||||||
reply_to_message_id=message.reply_to_message_id
|
reply_to_message_id=message.reply_to_message_id,
|
||||||
or message.reply_to_top_message_id,
|
message_thread_id=message.message_thread_id,
|
||||||
quote=False,
|
quote=False,
|
||||||
)
|
)
|
||||||
await message.safe_delete()
|
await message.safe_delete()
|
||||||
|
@ -18,8 +18,8 @@ async def xjj(message: Message, client: AsyncClient):
|
|||||||
await message.reply_video(
|
await message.reply_video(
|
||||||
url,
|
url,
|
||||||
quote=False,
|
quote=False,
|
||||||
reply_to_message_id=message.reply_to_message_id
|
reply_to_message_id=message.reply_to_message_id,
|
||||||
or message.reply_to_top_message_id,
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
await message.safe_delete()
|
await message.safe_delete()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -77,7 +77,7 @@ async def start_download(message: Message, url: str):
|
|||||||
cid,
|
cid,
|
||||||
video=file,
|
video=file,
|
||||||
supports_streaming=True,
|
supports_streaming=True,
|
||||||
reply_to_message_id=message.reply_to_top_message_id,
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
try:
|
try:
|
||||||
@ -85,7 +85,7 @@ async def start_download(message: Message, url: str):
|
|||||||
cid,
|
cid,
|
||||||
document=file,
|
document=file,
|
||||||
force_document=True,
|
force_document=True,
|
||||||
reply_to_message_id=message.reply_to_top_message_id,
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
result["status"] = False
|
result["status"] = False
|
||||||
|
@ -30,16 +30,16 @@ async def yv_lu(bot: Client, message: Message):
|
|||||||
try:
|
try:
|
||||||
await chat_response.copy(
|
await chat_response.copy(
|
||||||
message.chat.id,
|
message.chat.id,
|
||||||
reply_to_message_id=message.reply_to_message_id
|
reply_to_message_id=message.reply_to_message_id,
|
||||||
or message.reply_to_top_message_id,
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
except Flood as e:
|
except Flood as e:
|
||||||
await sleep(e.value + 1)
|
await sleep(e.value + 1)
|
||||||
with contextlib.suppress(Exception):
|
with contextlib.suppress(Exception):
|
||||||
await chat_response.copy(
|
await chat_response.copy(
|
||||||
message.chat.id,
|
message.chat.id,
|
||||||
reply_to_message_id=message.reply_to_message_id
|
reply_to_message_id=message.reply_to_message_id,
|
||||||
or message.reply_to_top_message_id,
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
@ -55,7 +55,6 @@ async def get_result(message, request, r18=2):
|
|||||||
@listener(command="zpr", description="随机获取一组涩涩纸片人。", parameters="{r18}")
|
@listener(command="zpr", description="随机获取一组涩涩纸片人。", parameters="{r18}")
|
||||||
async def zpr(client: Client, message: Message, request: AsyncClient):
|
async def zpr(client: Client, message: Message, request: AsyncClient):
|
||||||
arguments = message.arguments.upper().strip()
|
arguments = message.arguments.upper().strip()
|
||||||
message_thread_id = message.reply_to_top_message_id or message.reply_to_message_id
|
|
||||||
message = await message.edit("正在前往二次元。。。")
|
message = await message.edit("正在前往二次元。。。")
|
||||||
try:
|
try:
|
||||||
photoList, des = await get_result(
|
photoList, des = await get_result(
|
||||||
@ -68,7 +67,10 @@ async def zpr(client: Client, message: Message, request: AsyncClient):
|
|||||||
await message.edit("传送中。。。")
|
await message.edit("传送中。。。")
|
||||||
try:
|
try:
|
||||||
await client.send_media_group(
|
await client.send_media_group(
|
||||||
message.chat.id, photoList, reply_to_message_id=message_thread_id
|
message.chat.id,
|
||||||
|
photoList,
|
||||||
|
reply_to_message_id=message.reply_to_message_id,
|
||||||
|
message_thread_id=message.message_thread_id,
|
||||||
)
|
)
|
||||||
except RPCError as e:
|
except RPCError as e:
|
||||||
return await message.edit(
|
return await message.edit(
|
||||||
|
Loading…
Reference in New Issue
Block a user