Compare commits
3 commits
58f289d5d9
...
00234f691c
Author | SHA1 | Date | |
---|---|---|---|
00234f691c | |||
d8ff654c28 | |||
bbffcbdbc5 |
2 changed files with 27 additions and 4 deletions
|
@ -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}"
|
||||
)
|
||||
|
@ -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
|
||||
|
||||
|
|
|
@ -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"<blockquote expandable>{"\n\n".join(final_urls)}\n</blockquote>\n消息里有包含跟踪参数的链接,已经帮你转换了哦~\n\n"
|
||||
f"<blockquote expandable>{"\n\n".join(final_urls)}\n</blockquote>\n消息里有需要被处理的链接,"
|
||||
f"已经帮你处理了哦~\n\n"
|
||||
f"注意:这个功能是试验性的,可能会出现问题。"
|
||||
f"\n如果你找到了问题,欢迎"
|
||||
f"把它通过 <code>/report_broken_links 链接 需要去除的参数等等</code> 报告给开发者!")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue