From 10cb581b346bdc9866883764ae812cef8651f544 Mon Sep 17 00:00:00 2001 From: user Date: Sat, 1 Mar 2025 13:54:46 +0300 Subject: [PATCH] fix middleware --- app/bot/middleware.py | 2 +- app/client_bot/routers/content.py | 2 +- app/client_bot/routers/index.py | 3 +++ app/client_bot/routers/stars.py | 2 +- app/core/models/_telegram/templates/player.py | 2 +- locale/en/LC_MESSAGES/sanic_telegram_bot.mo | Bin 5806 -> 5767 bytes locale/en/LC_MESSAGES/sanic_telegram_bot.po | 6 +++--- 7 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/bot/middleware.py b/app/bot/middleware.py index 4ab1273..f926c4a 100644 --- a/app/bot/middleware.py +++ b/app/bot/middleware.py @@ -9,7 +9,7 @@ from datetime import datetime class UserDataMiddleware(BaseMiddleware): async def __call__(self, handler, event, data): - update_body = event.message or event.callback_query or event.inline_query + update_body = event.message or event.callback_query or event.inline_query or event.pre_checkout_query if not update_body: return diff --git a/app/client_bot/routers/content.py b/app/client_bot/routers/content.py index a1ae536..ec89420 100644 --- a/app/client_bot/routers/content.py +++ b/app/client_bot/routers/content.py @@ -174,7 +174,7 @@ async def t_inline_query_node_content(query: types.InlineQuery, memory=None, use content_share_link = { 'text': user.translated('p_shareLinkContext').format(title=' – '.join(audio_title)), - 'url': f"https://t.me/{CLIENT_TELEGRAM_BOT_USERNAME}?start=C{content.cid.serialize_v2()}" + 'url': f"https://t.me/{CLIENT_TELEGRAM_BOT_USERNAME}/content?startapp=C{content.cid.serialize_v2()}" } # Create inline query result using decrypted content's file_id diff --git a/app/client_bot/routers/index.py b/app/client_bot/routers/index.py index 607f5fa..88baa39 100644 --- a/app/client_bot/routers/index.py +++ b/app/client_bot/routers/index.py @@ -22,6 +22,9 @@ closing_router = Router() @closing_router.message() async def t_index(message: types.Message, **extra): + if message.write_access_allowed: + return + return await message.answer(extra['user'].translated('error_unknownCommand'), parse_mode='html') main_router.include_routers(closing_router) diff --git a/app/client_bot/routers/stars.py b/app/client_bot/routers/stars.py index 7c8dafc..fecc175 100644 --- a/app/client_bot/routers/stars.py +++ b/app/client_bot/routers/stars.py @@ -25,4 +25,4 @@ async def t_pre_checkout_query_stars_processing(pre_checkout_query: types.PreChe -router.pre_checkout_query.register(t_pre_checkout_query_stars_processing) \ No newline at end of file +router.pre_checkout_query.register(t_pre_checkout_query_stars_processing) diff --git a/app/core/models/_telegram/templates/player.py b/app/core/models/_telegram/templates/player.py index e8a469e..b8127ec 100644 --- a/app/core/models/_telegram/templates/player.py +++ b/app/core/models/_telegram/templates/player.py @@ -71,7 +71,7 @@ class PlayerTemplates: content_share_link = { 'text': self.user.translated('p_shareLinkContext').format(title=content_metadata_json.get('name', "")), - 'url': f"https://t.me/{CLIENT_TELEGRAM_BOT_USERNAME}?start=C{content.cid.serialize_v2()}" + 'url': f"https://t.me/{CLIENT_TELEGRAM_BOT_USERNAME}/content?startapp=C{content.cid.serialize_v2()}" } preview_content = db_session.query(StoredContent).filter( diff --git a/locale/en/LC_MESSAGES/sanic_telegram_bot.mo b/locale/en/LC_MESSAGES/sanic_telegram_bot.mo index 243cbdb51df67257298bc21af1e9ade9857ae387..fc1e8074db6ab25ac1b78b72380682f1efb6f615 100644 GIT binary patch delta 110 zcmZ3d+pfEThsjowfq_9&lz{<6J45MMAe{>2mjh{4Abl4~Gm9}Wn1R#-X*D37u-TL8 tr_kg;Q7I{g5A*xhC|sC-Vc&%<7q(v5ePPGNri(on8!z^6o+~QI2mlMD9WVd@ delta 134 zcmZqIU8lQ&hsjohfq_9&lz~AFNCyFF6(C&+q*H zW>2P{LLv$m8-cL+qbz)RFDw>rA;cs diff --git a/locale/en/LC_MESSAGES/sanic_telegram_bot.po b/locale/en/LC_MESSAGES/sanic_telegram_bot.po index 3db50c2..2a16c31 100644 --- a/locale/en/LC_MESSAGES/sanic_telegram_bot.po +++ b/locale/en/LC_MESSAGES/sanic_telegram_bot.po @@ -126,10 +126,10 @@ msgstr "" #: app/core/models/_telegram/templates/player.py:74 #: app/client_bot/routers/content.py:129 msgid "shareTrack_button" -msgstr "🎶 Поделиться треком" +msgstr "🎶 Поделиться" msgid "shareVideo_button" -msgstr "🎬 Поделиться видео" +msgstr "🎬 Поделиться" #: app/core/models/_telegram/templates/player.py:79 msgid "viewTrackAsClient_button" @@ -190,7 +190,7 @@ msgstr "" msgid "shareLink_button" -msgstr "🔗 Поделиться ссылкой" +msgstr "🔗 Поделиться" msgid "p_shareLinkContext" msgstr "🎉 Наслаждайтесь {title} на MY!"