fix audio share
This commit is contained in:
parent
00afde49a5
commit
9772729511
|
|
@ -136,7 +136,7 @@ async def t_inline_query_node_content(query: types.InlineQuery, memory=None, use
|
||||||
|
|
||||||
# Upload preview of decrypted content (limit to 30 seconds)
|
# Upload preview of decrypted content (limit to 30 seconds)
|
||||||
if content_type_declared in ('audio', 'video'):
|
if content_type_declared in ('audio', 'video'):
|
||||||
if True or 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_url = f"{PROJECT_HOST}/api/v1/storage/{decrypted_content.cid.serialize_v2(include_accept_type=True)}?seconds_limit=30"
|
preview_url = f"{PROJECT_HOST}/api/v1/storage/{decrypted_content.cid.serialize_v2(include_accept_type=True)}?seconds_limit=30"
|
||||||
|
|
@ -152,7 +152,10 @@ async def t_inline_query_node_content(query: types.InlineQuery, memory=None, use
|
||||||
preview_message = await query.bot.send_audio(
|
preview_message = await query.bot.send_audio(
|
||||||
chat_id=CACHE_CHAT_ID, # Cache chat id defined in configuration
|
chat_id=CACHE_CHAT_ID, # Cache chat id defined in configuration
|
||||||
audio=types.URLInputFile(preview_url), # Upload audio using URL
|
audio=types.URLInputFile(preview_url), # Upload audio using URL
|
||||||
caption="Preview upload" # English caption
|
caption="Preview upload", # English caption
|
||||||
|
title=title,
|
||||||
|
performer=performer,
|
||||||
|
thumbnail=result_kwargs.get('thumb_url'),
|
||||||
)
|
)
|
||||||
preview_file_id = preview_message.audio.file_id
|
preview_file_id = preview_message.audio.file_id
|
||||||
# Save the preview file_id in decrypted_content.meta for future use
|
# Save the preview file_id in decrypted_content.meta for future use
|
||||||
|
|
@ -170,8 +173,6 @@ async def t_inline_query_node_content(query: types.InlineQuery, memory=None, use
|
||||||
types.InlineQueryResultCachedAudio(
|
types.InlineQueryResultCachedAudio(
|
||||||
id=f"NC_{content.id}_{int(datetime.now().timestamp() // 60)}",
|
id=f"NC_{content.id}_{int(datetime.now().timestamp() // 60)}",
|
||||||
audio_file_id=decrypted_content.meta['telegram_file_cache_preview'],
|
audio_file_id=decrypted_content.meta['telegram_file_cache_preview'],
|
||||||
title=title,
|
|
||||||
performer=performer,
|
|
||||||
caption=hashtags_str + user.translated('p_playerContext_preview'),
|
caption=hashtags_str + user.translated('p_playerContext_preview'),
|
||||||
parse_mode='html',
|
parse_mode='html',
|
||||||
reply_markup=get_inline_keyboard([
|
reply_markup=get_inline_keyboard([
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue