add share inline context
This commit is contained in:
parent
758defee99
commit
3525f73b99
|
|
@ -18,6 +18,7 @@ from app.core.content.content_id import ContentId
|
|||
import base58
|
||||
from datetime import datetime, timedelta
|
||||
import asyncio
|
||||
import urllib
|
||||
from app.core._blockchain.ton.connect import TonConnect, wallet_obj_by_name
|
||||
|
||||
|
||||
|
|
@ -167,6 +168,11 @@ async def t_inline_query_node_content(query: types.InlineQuery, memory=None, use
|
|||
except Exception as e:
|
||||
make_log("OwnedContent", f"Error uploading preview {content_type_declared}: {e}", level='error')
|
||||
|
||||
content_share_link = {
|
||||
'text': user.translated('p_shareLinkContext').format(title=audio_title),
|
||||
'url': f"https://t.me/{CLIENT_TELEGRAM_BOT_USERNAME}?start=C{content.cid.serialize_v2()}"
|
||||
}
|
||||
|
||||
# Create inline query result using decrypted content's file_id
|
||||
if content_type_declared == 'audio':
|
||||
content_list.append(
|
||||
|
|
@ -176,13 +182,19 @@ async def t_inline_query_node_content(query: types.InlineQuery, memory=None, use
|
|||
caption=hashtags_str + user.translated('p_playerContext_preview'),
|
||||
parse_mode='html',
|
||||
reply_markup=get_inline_keyboard([
|
||||
[{
|
||||
[
|
||||
{
|
||||
'text': {
|
||||
'audio': user.translated('shareTrack_button'),
|
||||
'video': user.translated('shareVideo_button'),
|
||||
}[content_type_declared],
|
||||
'switch_inline_query': f"C{content.cid.serialize_v2()}"
|
||||
}],
|
||||
},
|
||||
{
|
||||
'text': user.translated('shareLink_button'),
|
||||
'url': f"https://t.me/share/url?text={urllib.parse.quote(content_share_link['text'])}&url={urllib.parse.quote(content_share_link['url'])}"
|
||||
}
|
||||
],
|
||||
[{
|
||||
'text': user.translated('viewTrack_button'),
|
||||
'url': f"https://t.me/MY_Web3Bot/content?startapp={content.cid.serialize_v2()}"
|
||||
|
|
@ -200,10 +212,17 @@ async def t_inline_query_node_content(query: types.InlineQuery, memory=None, use
|
|||
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('shareLink_button'),
|
||||
'url': f"https://t.me/share/url?text={urllib.parse.quote(content_share_link['text'])}&url={urllib.parse.quote(content_share_link['url'])}"
|
||||
}
|
||||
],
|
||||
|
||||
[{
|
||||
'text': user.translated('viewTrack_button'),
|
||||
'url': f"https://t.me/MY_Web3Bot/content?startapp={content.cid.serialize_v2()}"
|
||||
|
|
|
|||
Loading…
Reference in New Issue