diff --git a/mcp_bridge/telegram_bot.py b/mcp_bridge/telegram_bot.py index 78a50c0..fdea47a 100644 --- a/mcp_bridge/telegram_bot.py +++ b/mcp_bridge/telegram_bot.py @@ -258,6 +258,16 @@ class BridgeBot: return "".join(result) + async def _write_to_homelab_inbox(self, text: str, attribution: str = "claude.ai"): + """Write message to the homelab bot's inbox file for processing.""" + inbox_path = Path.home() / "homelab" / "telegram" / "inbox" + try: + with open(inbox_path, "a") as f: + f.write(f"[{attribution}] {text}\n") + logger.info(f"Wrote to homelab inbox: {text[:50]}...") + except Exception as e: + logger.error(f"Failed to write to homelab inbox: {e}") + async def _outbound_loop(self): """Poll outbound queue and send messages.""" while True: @@ -266,6 +276,7 @@ class BridgeBot: for msg in pending: try: await self.send_to_group(msg["content"], msg["attribution"]) + await self._write_to_homelab_inbox(msg["content"], msg["attribution"]) self.db.mark_outbound_sent(msg["id"]) logger.info(f"Sent outbound message {msg['id']}") except Exception as e: