fix inline share content
This commit is contained in:
parent
6886abec1a
commit
0b309c5eb4
|
|
@ -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
|
result_kwargs['thumb_url'] = cover_content.web_url
|
||||||
|
|
||||||
content_type_declared = decrypted_content_meta.get('content_type', 'application/x-binary').split('/')[0]
|
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()
|
hashtags_str = (' '.join(f"#{_h}" for _h in metadata_content_json.get('hashtags', []))).strip()
|
||||||
if hashtags_str:
|
if hashtags_str:
|
||||||
hashtags_str = hashtags_str + '\n'
|
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'):
|
if not decrypted_content.meta.get('telegram_file_cache_preview'):
|
||||||
try:
|
try:
|
||||||
# Construct URL for trimmed preview using decrypted content
|
# 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
|
preview_url = preview_content.web_url
|
||||||
if content_type_declared == 'video':
|
if content_type_declared == 'video':
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue