try fix video share bug
This commit is contained in:
parent
4f3056c9ef
commit
c23f28822b
|
|
@ -127,15 +127,18 @@ 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]
|
||||
hashtags_str = (' '.join(f"#{_h}" for _h in metadata_content_json.get('hashtags', []))).strip()
|
||||
if hashtags_str:
|
||||
hashtags_str = hashtags_str + '\n'
|
||||
|
||||
if content_type_declared == 'audio':
|
||||
content_list.append(
|
||||
types.InlineQueryResultAudio(
|
||||
id=f"NC_{content.id}",
|
||||
audio_url=decrypted_content.web_url + '?seconds_limit=30',
|
||||
title=title,
|
||||
performer=performer,
|
||||
caption=user.translated('p_playerContext_preview'),
|
||||
# audio_duration=
|
||||
caption=hashtags_str + user.translated('p_playerContext_preview'),
|
||||
parse_mode='html',
|
||||
reply_markup=get_inline_keyboard([
|
||||
[{
|
||||
|
|
@ -153,6 +156,27 @@ async def t_inline_query_node_content(query: types.InlineQuery, memory=None, use
|
|||
**result_kwargs
|
||||
)
|
||||
)
|
||||
elif content_type_declared == 'video':
|
||||
content_list.append(
|
||||
types.InlineQueryResultVideo(
|
||||
id=f"NC_{content.id}",
|
||||
video_url=decrypted_content.web_url + '?seconds_limit=30',
|
||||
title=title,
|
||||
caption=hashtags_str + user.translated('p_playerContext_preview'),
|
||||
parse_mode='html',
|
||||
reply_markup=get_inline_keyboard([
|
||||
[{
|
||||
'text': user.translated('shareVideo_button'),
|
||||
'switch_inline_query': f"C{content.cid.serialize_v2()}"
|
||||
}],
|
||||
[{
|
||||
'text': user.translated('viewTrack_button'),
|
||||
'url': f"https://t.me/MY_Web3Bot/content?startapp={content.cid.serialize_v2()}"
|
||||
}]
|
||||
]),
|
||||
**result_kwargs
|
||||
)
|
||||
)
|
||||
|
||||
return await query.answer(content_list, cache_time=1)
|
||||
except BaseException as e:
|
||||
|
|
|
|||
Loading…
Reference in New Issue