diff --git a/atadmins/main.py b/atadmins/main.py index 54e66de..52339d6 100644 --- a/atadmins/main.py +++ b/atadmins/main.py @@ -18,5 +18,5 @@ async def at_admins(client: Client, message: Message): say = message.arguments or "召唤本群所有管理员" send_list = ' , '.join(admins) await client.send_message(message.chat.id, "%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) await message.safe_delete() diff --git a/audio_to_voice/main.py b/audio_to_voice/main.py index 84aa2d7..b8ecbe1 100644 --- a/audio_to_voice/main.py +++ b/audio_to_voice/main.py @@ -22,7 +22,8 @@ async def audio_to_voice(bot: Client, message: Message): await bot.send_voice( message.chat.id, audio, - reply_to_message_id=message.id if message.audio else message.reply_to_message_id) + reply_to_message_id=message.id if message.audio else (message.reply_to_message_id or + message.reply_to_top_message_id)) except Exception as e: await message.edit(f"转换为语音消息失败:{e}") safe_remove(audio) diff --git a/getstickers/main.py b/getstickers/main.py index 32b265b..9517467 100644 --- a/getstickers/main.py +++ b/getstickers/main.py @@ -69,7 +69,7 @@ async def upload_sticker(bot: Client, message: Message, sticker_set: StickerSet) message.chat.id, f"{directory_name}.zip", 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, ) safe_remove(f"{directory_name}.zip") shutil.rmtree(directory_name) diff --git a/httpcat/main.py b/httpcat/main.py index 80c387b..9556821 100644 --- a/httpcat/main.py +++ b/httpcat/main.py @@ -20,5 +20,7 @@ async def httpcat(client: Client, message: Message, request: AsyncClient): await client.send_photo( message.chat.id, io, - reply_to_message_id=message.reply_to_message_id if message.outgoing else message.id) + reply_to_message_id=( + message.reply_to_message_id or message.reply_to_top_message_id + ) if message.outgoing else message.id) await message.safe_delete() diff --git a/netease/main.py b/netease/main.py index e5c0a0d..2fb2a2c 100644 --- a/netease/main.py +++ b/netease/main.py @@ -39,7 +39,10 @@ async def netease_search(keyword: str, message: Message): await conv.mark_as_read() answer: Message = await conv.get_response(filters=filters.audio) await conv.mark_as_read() - await answer.copy(message.chat.id, reply_to_message_id=message.reply_to_message_id) + await answer.copy( + message.chat.id, + reply_to_message_id=message.reply_to_message_id or message.reply_to_top_message_id + ) await message.safe_delete() @@ -49,7 +52,10 @@ async def netease_url(url: str, message: Message): await conv.mark_as_read() answer: Message = await conv.get_response(filters=filters.audio) await conv.mark_as_read() - await answer.copy(message.chat.id, reply_to_message_id=message.reply_to_message_id) + await answer.copy( + message.chat.id, + reply_to_message_id=message.reply_to_message_id or message.reply_to_top_message_id + ) await message.safe_delete() @@ -59,7 +65,10 @@ async def netease_id(music_id: str, message: Message): await conv.mark_as_read() answer: Message = await conv.get_response(filters=filters.audio) await conv.mark_as_read() - await answer.copy(message.chat.id, reply_to_message_id=message.reply_to_message_id) + await answer.copy( + message.chat.id, + reply_to_message_id=message.reply_to_message_id or message.reply_to_top_message_id + ) await message.safe_delete() diff --git a/vip/main.py b/vip/main.py index c698cf3..ca7be4f 100644 --- a/vip/main.py +++ b/vip/main.py @@ -53,7 +53,10 @@ async def weather_pic(client: Client, message: Message): async with client.conversation("PagerMaid_Modify_bot") as conv: answer: Message = await conv.ask(f"/weather {text}") await conv.mark_as_read() - await answer.copy(message.chat.id, reply_to_message_id=message.reply_to_message_id) + await answer.copy( + message.chat.id, + reply_to_message_id=message.reply_to_message_id or message.reply_to_top_message_id + ) await message.safe_delete() @@ -67,7 +70,10 @@ async def weather_he(client: Client, message: Message): async with client.conversation("PagerMaid_Modify_bot") as conv: answer: Message = await conv.ask(f"/weather_he {text}") await conv.mark_as_read() - await answer.copy(message.chat.id, reply_to_message_id=message.reply_to_message_id) + await answer.copy( + message.chat.id, + reply_to_message_id=message.reply_to_message_id or message.reply_to_top_message_id + ) await message.safe_delete() @@ -78,7 +84,10 @@ async def az_tts(client: Client, message: Message, mode: str): async with client.conversation("PagerMaid_Modify_bot") as conv: answer: Message = await conv.ask(f"/tts {text} {mode}") await conv.mark_as_read() - await answer.copy(message.chat.id, reply_to_message_id=message.reply_to_message_id) + await answer.copy( + message.chat.id, + reply_to_message_id=message.reply_to_message_id or message.reply_to_top_message_id + ) await message.safe_delete() diff --git a/weather_lite/main.py b/weather_lite/main.py index fa855bb..4e05f67 100644 --- a/weather_lite/main.py +++ b/weather_lite/main.py @@ -17,8 +17,10 @@ async def weather_lite(request: AsyncClient, message: Message): return await message.edit("请输入正确的城市名称") with open("weather.png", "wb") as f: f.write(data.content) - await message.reply_photo("weather.png", - reply_to_message_id=message.reply_to_message_id, - quote=False) + await message.reply_photo( + "weather.png", + reply_to_message_id=message.reply_to_message_id or message.reply_to_top_message_id, + quote=False + ) await message.safe_delete() safe_remove("weather.png") diff --git a/yvlu/main.py b/yvlu/main.py index 2b941dd..83738d0 100644 --- a/yvlu/main.py +++ b/yvlu/main.py @@ -31,13 +31,13 @@ async def yv_lu(bot: Client, message: Message): try: await chat_response.copy( 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) except Flood as e: await sleep(e.value + 1) with contextlib.suppress(Exception): await chat_response.copy( 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) except Exception: pass await message.safe_delete()