purchase notifications

This commit is contained in:
user committed 2024-10-28 17:43:53 +03:00
1 parent 2609495b91
commit 0f13479cb6
4 files changed
+34 -23

No files matched your search

+5 -23
View File
@@ -72,7 +72,11 @@ class PlayerTemplates:
if self.bot_id == 1:
inline_keyboard_array.append([{
'text': self.user.translated('shareTrack_button'),
'switch_inline_query': f"C{content.cid.serialize_v2()}"
'switch_inline_query': f"C{content.cid.serialize_v2()}",
}])
inline_keyboard_array.append([{
'text': self.user.translated('openTrackInApp_button'),
'url': f"https://t.me/{CLIENT_TELEGRAM_BOT_USERNAME}/content?startapp={content.cid.serialize_v2()}"
}])
else:
inline_keyboard_array.append([{
@@ -101,28 +105,6 @@ class PlayerTemplates:
)
if not have_access:
template_kwargs['audio'] = URLInputFile(local_content_url + '?seconds_limit=30')
purchase_action = self.db_session.query(UserAction).filter_by(
type='purchase',
from_address=user_wallet_address,
content_id=content.id,
status='requested'
).first()
if purchase_action:
inline_keyboard_array.append([{
'text': self.user.translated('gotoWallet_button'),
'url': purchase_action.meta['confirmation_url']
}])
inline_keyboard_array.append([{
'text': self.user.translated('cancelPurchase_button'),
'callback_data': f'PC_{content.id}_cancel'
}])
text = self.user.translated('p_playerContext_purchaseRequested')
else:
inline_keyboard_array.append([{
'text': self.user.translated('buyTrackListenLicense_button').format(price=str(round(0.15, 3))),
'callback_data': f'PC_{content.id}'
}])
text = self.user.translated('p_playerContext_preview')
make_log("TG-Player", f"Send content {content_type} ({content_encoding}) to chat {self._chat_id}. {cd_log}")
for kmsg in self.db_session.query(KnownTelegramMessage).filter_by(