1 line
8.9 KiB
JSON
1 line
8.9 KiB
JSON
{"repo": "b3h1z/ai-room-rent-agent", "files": {"SETUP.md": {"069a909b053b5883168356a3c4dcf733f0a8a34e": {"t": 1785674039.1237295, "n": 5660, "h": "8eaa1ed3e42f29b3", "c": "# Setup Guide for Room Finder AI Bot\n\nThis guide walks you through setting up the Room Finder AI Bot from scratch.\n\n## Prerequisites\n\n- Python 3.8 or higher\n- pip (Python package manager)\n- A Telegram account\n- A DeepSeek API key\n- (Optional) A WhatsApp account for WhatsApp bot functionality\n- (Optional) Docker for running WAHA server\n\n## Step 1: Clone the Repository\n\n```bash\ngit clone https://github.com/B3H1Z/AI-room-rent-agent.git\ncd AI-room-rent-agent\n```\n\n## Step 2: Create Virtual Environment\n\n```bash\n# Create virtual environment\npython -m venv venv\n\n# Activate it\n# On macOS/Linux:\nsource venv/bin/activate\n\n# On Windows:\nvenv\\Scripts\\activate\n```\n\n## Step 3: Install Dependencies\n\n```bash\npip install -r requirements.txt\n```\n\n## Step 4: Get Your Telegram Credentials\n\n### Get Telegram API ID and Hash\n\n1. Go to [my.telegram.org](https://my.telegram.org)\n2. Log in with your phone number\n3. Click \"API development tools\"\n4. Fill in the app name and click \"Create application\"\n5. You'll get your **API ID** and **API Hash**\n6. Save these - you'll need them in the `.env` file\n\n### Get Target Group Information\n\n1. In Telegram, add the bot to your target group\n2. To find the group username:\n - For public groups: it's visible in the group info\n - For private groups: you need to know the group ID\n\n3. To find the topic ID (if using topics):\n - Right-click on the topic and select \"Copy Topic Link\"\n - The number at the end is your topic ID\n\n## Step 5: Get DeepSeek API Key\n\n1. Visit [DeepSeek](https://www.deepseek.com)\n2. Sign up for an account\n3. Go to API settings in your account dashboard\n4. Generate a new API key\n5. Save it - you won't be able to view it again!\n\n## Step 6: Configure Environment\n\n1. Copy the example configuration:\n ```bash\n cp .env.example .env\n ```\n\n2. Edit `.env` with your values:\n ```bash\n nano .env # or use your preferred editor\n ```\n\n3. Fill in all required fields:\n\n ```env\n # TELEGRAM section\n TELEGRAM_API_ID=your_actual_api_id\n TELEGRAM_API_HASH=your_actual_api_hash\n TELEGRAM_SESSION_NAME=session_name\n TELEGRAM_TARGET_GROUP=AffittiPadova # group username without @\n TELEGRAM_TARGET_TOPIC_ID=146633 # only needed if using topics\n \n # DEEPSEEK section\n DEEPSEEK_API_KEY=sk-xxxxxxxxxxxx\n DEEPSEEK_API_URL=https://api.deepseek.com/chat/completions\n \n # USER PROFILE section - used in LLM prompts\n USER_NAME=Your Name\n FIELD_OF_STUDY=Your Field (e.g., Information Engineering)\n USER_AGE=your_age\n \n # SEARCH CRITERIA\n MAX_RENT=550 # Maximum rent in euros\n \n # WHATSAPP section (only if using WhatsApp bot)\n WAHA_API=http://localhost:3010/api\n WAHA_SESSION=default\n WAHA_API_KEY=your_waha_key\n WAHA_TARGET_GROUPS=group_id1@g.us,group_id2@g.us\n ```\n\n## Step 7: (Optional) Setup WhatsApp Bot with WAHA\n\nIf you want to use the WhatsApp bot:\n\n### Option A: Docker (Recommended)\n\n```bash\ndocker run -p 3010:3010 devlikeapro/waha\n```\n\nThen configure the WAHA settings in `.env`.\n\n### Option B: Local Installation\n\nFollow [WAHA documentation](https://waha.devlikeapro.com) for local setup.\n\n## Step 8: Run the Bot\n\n### Telegram Bot Only\n\n```bash\npython telegram_bot.py\n```\n\n**First run**: Telegram will ask you to verify with a code sent to your phone. Follow the prompts.\n\nExpected output:\n```\nRoom Finder Bot is running...\n```\n\n### WhatsApp Bot Only\n\n```bash\npython whatsapp_bot.py\n```\n\n### Both Bots (Separate Terminals)\n\nTerminal 1:\n```bash\npython telegram_bot.py\n```\n\nTerminal 2:\n```bash\npython whatsapp_bot.py\n```\n\n## Step 9: Test Your Setup\n\n1. Post a test message in the monitored group that matches your criteria\n2. Watch the console for matching logs\n3. Check if the bot sends you a DM\n\n## Troubleshooting\n\n### \"Conflict\" Error on Startup\n- **Problem**: Another instance of the bot is running with the same session\n- **Solution**: \n - Find and kill the other process: `pkill -f telegram_bot.py`\n - Or use a different `TELEGRAM_SESSION_NAME` in `.env`\n\n### \"API key not valid\" Error\n- **Problem**: Invalid DeepSeek API key\n- **Solution**: \n - Check you're using the correct key (it starts with `sk-`)\n - Generate a new key from DeepSeek dashboard\n - Update `.env` with the new key\n\n### \"No module named 'telethon'\" Error\n- **Problem**: Dependencies not installed\n- **Solution**: \n ```bash\n pip install -r requirements.txt\n ```\n\n### Bot Not Responding to Messages\n- **Problem**: Various possible causes\n- **Solutions**:\n - Check the console logs for error messages\n - Verify the bot is actually running (should print \"Room Finder Bot is running...\")\n - Ensure target group/topic IDs are correct\n - Test with a simple message that clearly matches criteria\n\n### WhatsApp Bot Errors\n- **Problem**: WAHA connection issues\n- **Solution**:\n - Verify WAHA server is running: `curl http://localhost:3010/api/ping`\n - Check WAHA API key is correct\n - Restart WAHA: `docker restart <container-id>`\n\n## Security Notes\n\n⚠️ **IMPORTANT**:\n- **Never commit `.env` file to Git** (it's in `.gitignore`)\n- Keep your API keys private\n- Don't share your `TELEGRAM_API_HASH` with anyone\n- Consider rotating API keys periodically\n- Use strong, unique values for sensitive fields\n\n## Next Steps\n\n1. **Customize search criteria** in `.env` and `ai_utils.py` keywords\n2. **Add more groups** by duplicating the bot logic\n3. **Improve message templates** in `ai_utils.py`\n4. **Set up logging** for production use\n\n## Getting Help\n\n- Check the logs in console output\n- Review [README.md](README.md) for feature overview\n- Check original issue/error messages carefully\n- Open a GitHub issue if you encounter new problems\n\nHappy apartment hunting! 🏠\n"}}, ".env.example": {"069a909b053b5883168356a3c4dcf733f0a8a34e": {"t": 1785745131.242914, "n": 642, "h": "f5a49a3856423d15", "c": "# Telegram Configuration\nTELEGRAM_API_ID=your_telegram_api_id\nTELEGRAM_API_HASH=your_telegram_api_hash\nTELEGRAM_SESSION_NAME=session_name\nTELEGRAM_TARGET_GROUP=your_target_group\nTELEGRAM_TARGET_TOPIC_ID=your_topic_id\n\n# DeepSeek API Configuration\nDEEPSEEK_API_KEY=your_deepseek_api_key\nDEEPSEEK_API_URL=https://api.deepseek.com/chat/completions\n\n# User Profile\nUSER_NAME=Your Name\nFIELD_OF_STUDY=Your Field\nUSER_AGE=your_age\n\n# Room Search Criteria\nMAX_RENT=550\n\n# WhatsApp Configuration\nWAHA_API=http://localhost:3010/api\nWAHA_SESSION=default\nWAHA_API_KEY=your_waha_api_key\nWAHA_TARGET_GROUPS=group_id_1@g.us,group_id_2@g.us,group_id_3@g.us\n"}}, "setup.sh": {"069a909b053b5883168356a3c4dcf733f0a8a34e": {"t": 1785745943.015562, "n": 1919, "h": "0d9e1767df248a57", "c": "#!/bin/bash\n# setup.sh - Automated setup script for Room Finder AI Bot\n\nset -e\n\necho \"🏠 Room Finder AI Bot - Setup Script\"\necho \"====================================\"\necho \"\"\n\n# Check Python version\necho \"✓ Checking Python version...\"\npython_version=$(python3 --version | cut -d' ' -f2 | cut -d'.' -f1,2)\nrequired_version=\"3.8\"\n\nif [ \"$(printf '%s\\n' \"$required_version\" \"$python_version\" | sort -V | head -n1)\" = \"$required_version\" ]; then \n echo \"✓ Python $python_version detected (required: $required_version+)\"\nelse\n echo \"✗ Python 3.8+ required. Found: $python_version\"\n exit 1\nfi\n\n# Create virtual environment\necho \"\"\necho \"✓ Creating virtual environment...\"\nif [ ! -d \"venv\" ]; then\n python3 -m venv venv\n echo \"✓ Virtual environment created\"\nelse\n echo \"✓ Virtual environment already exists\"\nfi\n\n# Activate virtual environment\necho \"✓ Activating virtual environment...\"\nsource venv/bin/activate\n\n# Install dependencies\necho \"\"\necho \"✓ Installing dependencies...\"\npip install --upgrade pip\npip install -r requirements.txt\necho \"✓ Dependencies installed\"\n\n# Setup .env file\necho \"\"\necho \"✓ Setting up environment configuration...\"\nif [ ! -f \".env\" ]; then\n cp .env.example .env\n echo \"✓ Created .env file from .env.example\"\n echo \"⚠️ IMPORTANT: Edit .env with your credentials:\"\n echo \" - TELEGRAM_API_ID\"\n echo \" - TELEGRAM_API_HASH\"\n echo \" - DEEPSEEK_API_KEY\"\n echo \" - WAHA_API_KEY (if using WhatsApp)\"\nelse\n echo \"✓ .env file already exists\"\nfi\n\n# Set secure permissions\nchmod 600 .env 2>/dev/null || true\n\n# Final message\necho \"\"\necho \"✅ Setup complete!\"\necho \"\"\necho \"Next steps:\"\necho \"1. Edit .env with your credentials\"\necho \"2. Activate virtual environment: source venv/bin/activate\"\necho \"3. Run Telegram bot: python telegram_bot.py\"\necho \"4. Or run WhatsApp bot: python whatsapp_bot.py\"\necho \"\"\necho \"For detailed setup instructions, see SETUP.md\"\n"}}}} |