fix inline share content

This commit is contained in:
user 2025-03-07 12:36:57 +03:00
parent 6886abec1a
commit 0b309c5eb4
1 changed files with 10 additions and 3 deletions

View File

@ -152,6 +152,16 @@ async def t_inline_query_node_content(query: types.InlineQuery, memory=None, use
result_kwargs['thumb_url'] = cover_content.web_url
content_type_declared = decrypted_content_meta.get('content_type', 'application/x-binary').split('/')[0]
preview_content = db_session.query(StoredContent).filter_by(
hash=content.meta.get('converted_content', {}).get('low_preview')
).first()
content_type_declared = {
'mp3': 'audio',
'flac': 'audio',
'mp4': 'video',
'mov': 'video'
}.get(preview_content.filename.split('.')[-1], content_type_declared)
hashtags_str = (' '.join(f"#{_h}" for _h in metadata_content_json.get('hashtags', []))).strip()
if hashtags_str:
hashtags_str = hashtags_str + '\n'
@ -161,9 +171,6 @@ async def t_inline_query_node_content(query: types.InlineQuery, memory=None, use
if not decrypted_content.meta.get('telegram_file_cache_preview'):
try:
# Construct URL for trimmed preview using decrypted content
preview_content = db_session.query(StoredContent).filter_by(
hash=content.meta.get('converted_content', {}).get('low_preview')
).first()
preview_url = preview_content.web_url
if content_type_declared == 'video':