From fff77f51f8534d214ca13ef18aa4307bfc614ccb Mon Sep 17 00:00:00 2001 From: mctaylors Date: Sat, 7 Jun 2025 20:58:01 +0300 Subject: [PATCH] fix: do not search for posts below or equal to ID 0 Signed-off-by: mctaylors --- inline_query.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/inline_query.py b/inline_query.py index f2ec2cd..a3d867b 100644 --- a/inline_query.py +++ b/inline_query.py @@ -24,6 +24,10 @@ async def inline_query(update: Update, context: ContextTypes.DEFAULT_TYPE) -> No if not query.isdigit(): return + query = int(query) + + if query <= 0: + return data = get_json(f"posts/{query}") if data is None: @@ -33,7 +37,7 @@ async def inline_query(update: Update, context: ContextTypes.DEFAULT_TYPE) -> No await answer_query(update, query, data) -async def answer_query(update: Update, query: str, data) -> None: +async def answer_query(update: Update, query: int, data) -> None: characters = humanize_tags_from_json(data["tag_string_character"], "no characters") copyrights = humanize_tags_from_json( data["tag_string_copyright"], "unknown copyright" @@ -110,7 +114,7 @@ async def answer_query(update: Update, query: str, data) -> None: await update.inline_query.answer(results) -async def invalid_query(update: Update, query: str) -> None: +async def invalid_query(update: Update, query: int) -> None: results = [ InlineQueryResultArticle( id=str(uuid4()),