mirror of
https://github.com/PaiGramTeam/PamGram.git
synced 2024-11-16 03:55:26 +00:00
🐛 Fix telegram api 6.8 changes
This commit is contained in:
parent
2b6732f3cb
commit
f85a774d9d
@ -9,6 +9,7 @@ from telegram import (
|
||||
InlineQueryResultCachedDocument,
|
||||
InputTextMessageContent,
|
||||
Update,
|
||||
InlineQueryResultsButton,
|
||||
)
|
||||
from telegram.constants import ParseMode
|
||||
from telegram.error import BadRequest
|
||||
@ -148,7 +149,7 @@ class Inline(Plugin):
|
||||
id=str(uuid4()),
|
||||
title=name,
|
||||
description=f"{args[0]} {name}",
|
||||
thumb_url=icon,
|
||||
thumbnail_url=icon,
|
||||
input_message_content=InputTextMessageContent(
|
||||
f"{temp_data[1]}{name}", parse_mode=ParseMode.MARKDOWN_V2
|
||||
),
|
||||
@ -162,7 +163,7 @@ class Inline(Plugin):
|
||||
id=str(uuid4()),
|
||||
title=f"当前查询内容为 {args[0]}",
|
||||
description="如果无查看图片描述 这是正常的 客户端问题",
|
||||
thumb_url="https://www.miyoushe.com/_nuxt/img/game-sr.4f80911.jpg",
|
||||
thumbnail_url="https://www.miyoushe.com/_nuxt/img/game-sr.4f80911.jpg",
|
||||
input_message_content=InputTextMessageContent(f"当前查询内容为 {args[0]}\n如果无查看图片描述 这是正常的 客户端问题"),
|
||||
)
|
||||
)
|
||||
@ -203,10 +204,12 @@ class Inline(Plugin):
|
||||
try:
|
||||
await ilq.answer(
|
||||
results=results_list,
|
||||
switch_pm_text=switch_pm_text,
|
||||
switch_pm_parameter="inline_message",
|
||||
cache_time=0,
|
||||
auto_pagination=True,
|
||||
button=InlineQueryResultsButton(
|
||||
text=switch_pm_text,
|
||||
start_parameter="inline_message",
|
||||
),
|
||||
)
|
||||
except BadRequest as exc:
|
||||
if "Query is too old" in exc.message: # 过时请求全部忽略
|
||||
@ -217,6 +220,8 @@ class Inline(Plugin):
|
||||
logger.warning("inline_query发生BadRequest错误", exc_info=exc)
|
||||
await ilq.answer(
|
||||
results=[],
|
||||
switch_pm_text="糟糕,发生错误了。",
|
||||
switch_pm_parameter="inline_message",
|
||||
button=InlineQueryResultsButton(
|
||||
text="糟糕,发生错误了。",
|
||||
start_parameter="inline_message",
|
||||
),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user