Commit ad7c32e
Changed files (1)
src
history
src/history/query.py
@@ -53,7 +53,7 @@ HELP = f"""🗣**查询当前对话聊天记录**
async def query_chat_history(client: Client, message: Message, **kwargs):
if not startswith_prefix(message.content, prefix=PREFIX.HISTORY):
return
- if equal_prefix(message.content, prefix=PREFIX.HISTORY):
+ if equal_prefix(message.content, prefix=PREFIX.HISTORY) and not message.reply_to_message:
await send2tg(client, message, texts=HELP, **kwargs)
return
info = parse_msg(message, silent=True, use_cache=False)
@@ -64,6 +64,9 @@ async def query_chat_history(client: Client, message: Message, **kwargs):
if info["text"].strip() == "/history -l":
await list_chat_ids(client, message, engine=HISTORY.QUERY_ENGINE)
return
+ # if use `/hist` reply to a message
+ if info["text"] in ["/hist", "/history"] and message.reply_to_message:
+ info["text"] = f"/hist @{info['reply_uid']}"
qtype = "history" if startswith_prefix(info["text"].strip(), prefix="/history") else "hist"
chat_id, match_time, user, keyword, error = parse_queries(info["text"], qtype)