Skip to content

Commit c8890d4

Browse files
author
Marten (msc)
committed
[FIX] private chat mention
1 parent 1ef3ec0 commit c8890d4

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

summaree_bot/bot/premium.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,12 @@ async def check_premium_features(update: Update, context: ContextTypes.DEFAULT_T
590590
int, voice.file_size if voice else audio.file_size if audio else document.file_size if document else 0
591591
)
592592
subscription_keyboard = get_subscription_keyboard(update, context)
593+
594+
try:
595+
chat_mention_text = update.effective_chat.mention_markdown_v2()
596+
except ValueError:
597+
chat_mention_text = f"`chat_id: {update.effective_chat.id}` (private)"
598+
593599
if file_size > 10 * 1024 * 1024:
594600
if not any_user_in_chat_is_premium:
595601
# if no user in the chat has an active premium subscription, show a message
@@ -616,7 +622,7 @@ async def check_premium_features(update: Update, context: ContextTypes.DEFAULT_T
616622
text=(
617623
f"User {update.effective_user.mention_markdown_v2()} tried to send "
618624
f"a file than was {escape_markdown(f'{file_size / 1024 / 1024:.2f} MB', version=2)}\n"
619-
f"\(in chat {update.effective_chat.mention_markdown_v2()}\)"
625+
f"\(in chat {chat_mention_text}\)"
620626
),
621627
parse_mode=ParseMode.MARKDOWN_V2,
622628
)
@@ -683,7 +689,7 @@ async def check_premium_features(update: Update, context: ContextTypes.DEFAULT_T
683689
admin_message = AdminChannelMessage(
684690
text=(
685691
f"User {update.effective_user.mention_markdown_v2()} tried to send a video message "
686-
f"\(in chat {update.effective_chat.mention_markdown_v2()}\)"
692+
f"\(in chat {chat_mention_text}\)"
687693
),
688694
parse_mode=ParseMode.MARKDOWN_V2,
689695
)

0 commit comments

Comments
 (0)