From bbffcbdbc5f77c356ea615bbe5941cbb7175642f Mon Sep 17 00:00:00 2001 From: grassblock Date: Fri, 12 Sep 2025 21:01:16 +0800 Subject: [PATCH 1/3] fix: format inline clean link format --- core/inline.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/inline.py b/core/inline.py index ebd128e..72e12e7 100644 --- a/core/inline.py +++ b/core/inline.py @@ -196,7 +196,7 @@ async def handle_inline_query(query: InlineQuery): title="清理后的链接", input_message_content=InputTextMessageContent( message_text=Text(ExpandableBlockQuote(result)).as_markdown(), - parse_mode=ParseMode.MARKDOWN + parse_mode=ParseMode.MARKDOWN_V2 ), description=f"发送清理后的链接:{result}" ) From d8ff654c28426e5751a3a98628aa0c836af9deeb Mon Sep 17 00:00:00 2001 From: grassblock Date: Fri, 12 Sep 2025 21:07:35 +0800 Subject: [PATCH 2/3] fix: youtu.be links transform format --- core/link.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/link.py b/core/link.py index 0a0f351..41e7a88 100644 --- a/core/link.py +++ b/core/link.py @@ -222,6 +222,10 @@ def transform_into_fixed_url(url): return urlunparse(parsed_url._replace(netloc='www.douyin.com')) if parsed_url.hostname in ['youtu.be','m.youtube.com']: # 把 youtu.be 和 m.youtube.com 的链接转换为 www.youtube.com + if parsed_url.hostname == 'youtu.be': + # youtu.be 的链接需要把 path 的 / 替换为 v 参数 + video_id = parsed_url.path.lstrip('/') + return urlunparse(parsed_url._replace(netloc='www.youtube.com', path='/watch', query=urlencode({'v': video_id}))) return urlunparse(parsed_url._replace(netloc='www.youtube.com')) return url @@ -290,7 +294,8 @@ async def handle_links(message: Message): # 回复处理后的链接 if final_urls: await message.reply( - f"
{"\n\n".join(final_urls)}\n
\n消息里有包含跟踪参数的链接,已经帮你转换了哦~\n\n" + f"
{"\n\n".join(final_urls)}\n
\n消息里有需要被处理的链接," + f"已经帮你处理了哦~\n\n" f"注意:这个功能是试验性的,可能会出现问题。" f"\n如果你找到了问题,欢迎" f"把它通过 /report_broken_links 链接 需要去除的参数等等 报告给开发者!") From 00234f691c17f4ab4e2970da127fd2a6996bc630 Mon Sep 17 00:00:00 2001 From: grassblock Date: Fri, 12 Sep 2025 21:16:31 +0800 Subject: [PATCH 3/3] feat: add spaces to all texts in inline mode --- core/inline.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/core/inline.py b/core/inline.py index 72e12e7..266778b 100644 --- a/core/inline.py +++ b/core/inline.py @@ -293,8 +293,26 @@ async def handle_inline_query(query: InlineQuery): message_text="小娜😭", parse_mode=ParseMode.MARKDOWN ), - description="很抱歉,我还不能理解你说的内容。" - ) + description="很抱歉,我还不能理解你说的内容,但你可以试试:" + ), + InlineQueryResultArticle( + id="3", + title=f"全 部 加 上 空 格", + input_message_content=InputTextMessageContent( + message_text=" ".join(query_text), + parse_mode=ParseMode.MARKDOWN + ), + description="很臭的功能" + ), + InlineQueryResultArticle( + id="4", + title=f"命令列表", + input_message_content=InputTextMessageContent( + message_text=query_text, + parse_mode=ParseMode.MARKDOWN + ), + description="search, pg, anuo, 将军" + ), ], cache_time=0) return