Compare commits

..

13 commits

Author SHA1 Message Date
e5cbed59d3
Merge branch 'master' into info_command 2025-05-18 11:08:52 +03:00
84a897868d feat: use LinkPreviewOptions in answer_query
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
2025-05-18 11:08:09 +03:00
b4e406d351 feat: add /info command, pt. 2
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
2025-05-18 10:54:44 +03:00
4107e6769f Merge branch 'master' into info_command
# Conflicts:
#	extensions.py
2025-05-18 10:32:18 +03:00
f2b6a2ee8f chore: make return None statement explicit in format_rating
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
2025-05-18 10:30:53 +03:00
38bcaff243 Merge branch 'master' into info_command 2025-05-18 10:13:13 +03:00
35ea45d9c7 fix: set encoding for _c.read
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
2025-05-18 10:12:35 +03:00
89f5b35395 feat: add /info command, pt. 1 2025-05-18 01:44:46 +03:00
93e3ca4f96 refactor: define parameter types *again* 2025-05-17 23:23:14 +03:00
bd39df5368 i18n: use strings from Danbooru 2025-05-17 00:07:30 +03:00
8909210e2e fix: add is_banned check 2025-05-17 00:05:45 +03:00
3518f4bbf0 chore: remove unused imports 2025-05-16 23:53:11 +03:00
58d7050dc3 pip: add requirements.txt 2025-05-16 23:36:49 +03:00
2 changed files with 13 additions and 4 deletions

View file

@ -7,7 +7,14 @@ from config import app
def humanize_tags_from_json(value: str, default: str) -> str:
if value != "":
return ", ".join([re.sub('_\\(.*', '', t) for t in value.split()])
output = str()
tags = value.split()
for t in tags:
output += f"{re.sub('_\\(.*', '', t)}, "
output = output[:-2]
return output
return default

View file

@ -40,7 +40,8 @@ async def answer_query(update: Update, query: str, data) -> None:
title=f"ID: {query}",
description=f"{characters} ({copyrights}) drawn by {artists}",
input_message_content=InputTextMessageContent(
f"<code>#{query}</code> <s><b>{characters} ({copyrights})</b> drawn by <b>{artists}</b></s> {rating}\n"
f"ID: <code>{query}</code> {rating}\n"
f"<s><b>{characters} ({copyrights})</b> drawn by <b>{artists}</b></s>\n"
f"This post has been removed because of a takedown request or rule violation.",
parse_mode=ParseMode.HTML
)
@ -65,7 +66,8 @@ async def answer_query(update: Update, query: str, data) -> None:
description=f"{characters} ({copyrights}) drawn by {artists}",
thumbnail_url=data['preview_file_url'],
input_message_content=InputTextMessageContent(
f"<code>#{query}</code> <b>{characters} ({copyrights})</b> drawn by <b>{artists}</b> {rating}",
f"ID: <code>{query}</code> {rating}\n"
f"<b>{characters} ({copyrights})</b> drawn by <b>{artists}</b>",
parse_mode=ParseMode.HTML,
link_preview_options=LinkPreviewOptions(url=data['large_file_url'])
),
@ -83,7 +85,7 @@ async def invalid_query(update: Update, query: str) -> None:
title=f"ID: {query}",
description="Error",
input_message_content=InputTextMessageContent(
f"<code>#{query}</code>\n"
f"ID: <code>{query}</code>\n"
f"That record was not found.",
parse_mode=ParseMode.HTML
)