fix: do not search for posts below or equal to ID 0
All checks were successful
Build / Upload to production (push) Successful in 1m46s
All checks were successful
Build / Upload to production (push) Successful in 1m46s
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
This commit is contained in:
parent
8568d788db
commit
fff77f51f8
1 changed files with 6 additions and 2 deletions
|
@ -24,6 +24,10 @@ async def inline_query(update: Update, context: ContextTypes.DEFAULT_TYPE) -> No
|
||||||
|
|
||||||
if not query.isdigit():
|
if not query.isdigit():
|
||||||
return
|
return
|
||||||
|
query = int(query)
|
||||||
|
|
||||||
|
if query <= 0:
|
||||||
|
return
|
||||||
|
|
||||||
data = get_json(f"posts/{query}")
|
data = get_json(f"posts/{query}")
|
||||||
if data is None:
|
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)
|
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")
|
characters = humanize_tags_from_json(data["tag_string_character"], "no characters")
|
||||||
copyrights = humanize_tags_from_json(
|
copyrights = humanize_tags_from_json(
|
||||||
data["tag_string_copyright"], "unknown copyright"
|
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)
|
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 = [
|
results = [
|
||||||
InlineQueryResultArticle(
|
InlineQueryResultArticle(
|
||||||
id=str(uuid4()),
|
id=str(uuid4()),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue