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