Inline mode number of suggestions decreased

This commit is contained in:
Profitroll 2022-11-22 15:26:34 +01:00
parent 359f08c021
commit a54994fe88
2 changed files with 12 additions and 1 deletions

View File

@ -6,6 +6,7 @@
"birthdays_notify": true, "birthdays_notify": true,
"birthdays_time": "09:00", "birthdays_time": "09:00",
"api": "http://example.com", "api": "http://example.com",
"inline_preview_count": 7,
"admin_group": 0, "admin_group": 0,
"destination_group": 0, "destination_group": 0,
"admins": [], "admins": [],

View File

@ -28,7 +28,7 @@ async def inline_answer(client, inline_query):
if (path.exists(f"{configGet('data', 'locations')}{sep}users{sep}{inline_query.from_user.id}.json") and jsonLoad(f"{configGet('data', 'locations')}{sep}users{sep}{inline_query.from_user.id}.json")["approved"]) or (await isAnAdmin(inline_query.from_user.id)): if (path.exists(f"{configGet('data', 'locations')}{sep}users{sep}{inline_query.from_user.id}.json") and jsonLoad(f"{configGet('data', 'locations')}{sep}users{sep}{inline_query.from_user.id}.json")["approved"]) or (await isAnAdmin(inline_query.from_user.id)):
list_of_users = [] list_of_users = []
async for m in app.get_chat_members(configGet("destination_group"), filter=ChatMembersFilter.SEARCH, query=inline_query.query): async for m in app.get_chat_members(configGet("destination_group"), limit=configGet("inline_preview_count"), filter=ChatMembersFilter.SEARCH, query=inline_query.query):
list_of_users.append(m) list_of_users.append(m)
results = [] results = []
@ -75,6 +75,16 @@ async def inline_answer(client, inline_query):
description=locale("description", "inline", "user").format(match.user.first_name, match.user.username) description=locale("description", "inline", "user").format(match.user.first_name, match.user.username)
) )
) )
except FileNotFoundError:
results.append(
InlineQueryResultArticle(
title=str(match.user.first_name),
input_message_content=InputTextMessageContent(
locale("message_content", "inline", "user").format(match.user.first_name, match.user.username, "\n".join(application_content))
),
description=locale("description", "inline", "user").format(match.user.first_name, match.user.username)
)
)
else: else:
results.append( results.append(
InlineQueryResultArticle( InlineQueryResultArticle(