diff --git a/bsky.py b/bsky.py index 1afd51a..fa6e58f 100644 --- a/bsky.py +++ b/bsky.py @@ -588,20 +588,22 @@ Use the bluesky_reply tool to send a response less than 300 characters.""" # Send the reply(s) with language if len(reply_messages) == 1: # Single reply - use existing function - logger.info(f"Sending single reply: {reply_messages[0][:50]}... (lang: {reply_lang})") + cleaned_text = bsky_utils.remove_outside_quotes(reply_messages[0]) + logger.info(f"Sending single reply: {cleaned_text[:50]}... (lang: {reply_lang})") response = bsky_utils.reply_to_notification( client=atproto_client, notification=notification_data, - reply_text=reply_messages[0], + reply_text=cleaned_text, lang=reply_lang ) else: # Multiple replies - use new threaded function - logger.info(f"Sending threaded reply with {len(reply_messages)} messages (lang: {reply_lang})") + cleaned_messages = [bsky_utils.remove_outside_quotes(msg) for msg in reply_messages] + logger.info(f"Sending threaded reply with {len(cleaned_messages)} messages (lang: {reply_lang})") response = bsky_utils.reply_with_thread_to_notification( client=atproto_client, notification=notification_data, - reply_messages=reply_messages, + reply_messages=cleaned_messages, lang=reply_lang ) diff --git a/bsky_utils.py b/bsky_utils.py index f4ee80d..091e5e9 100644 --- a/bsky_utils.py +++ b/bsky_utils.py @@ -253,6 +253,31 @@ def default_login() -> Client: return init_client(username, password) +def remove_outside_quotes(text: str) -> str: + """ + Remove outside double quotes from response text. + + Only handles double quotes to avoid interfering with contractions: + - Double quotes: "text" → text + - Preserves single quotes and internal quotes + + Args: + text: The text to process + + Returns: + Text with outside double quotes removed + """ + if not text or len(text) < 2: + return text + + text = text.strip() + + # Only remove double quotes from start and end + if text.startswith('"') and text.endswith('"'): + return text[1:-1] + + return text + def reply_to_post(client: Client, text: str, reply_to_uri: str, reply_to_cid: str, root_uri: Optional[str] = None, root_cid: Optional[str] = None, lang: Optional[str] = None) -> Dict[str, Any]: """ Reply to a post on Bluesky with rich text support.