#!/bin/bash
# Create minimal config.json files for each bot
# These only contain channel-specific settings that can't be in env vars

set -e

echo "Creating bot config files..."

# Bot 1 config
cat > ~/.nanobot-user1/config.json << 'EOF'
{
  "channels": {
    "telegram": {
      "enabled": true,
      "allowFrom": ["TADec2023"]
    },
    "email": {
      "enabled": true,
      "allowFrom": ["adayear2025@gmail.com"]
    }
  },
  "tools": {
    "mcpServers": {
      "gitea": {
        "command": "/app/mcp-servers/gitea-mcp/gitea-mcp",
        "args": ["-t", "stdio", "--host", "http://10.0.30.169:3000", "-r"],
        "env": {
          "GITEA_ACCESS_TOKEN": "$NANOBOT_GITLE_TOKEN"
        }
      }
    }
  }
}
EOF

# Bot 2 config (placeholder - update with actual values)
cat > ~/.nanobot-user2/config.json << 'EOF'
{
  "channels": {
    "telegram": {
      "enabled": true,
      "allowFrom": []
    },
    "email": {
      "enabled": true,
      "allowFrom": []
    }
  }
}
EOF

# Bot 3 config (placeholder - update with actual values)
cat > ~/.nanobot-user3/config.json << 'EOF'
{
  "channels": {
    "telegram": {
      "enabled": true,
      "allowFrom": []
    },
    "email": {
      "enabled": true,
      "allowFrom": []
    }
  }
}
EOF

echo "✓ Created config files:"
echo "  - ~/.nanobot-user1/config.json"
echo "  - ~/.nanobot-user2/config.json"
echo "  - ~/.nanobot-user3/config.json"
echo ""
echo "Note: Telegram tokens come from .env.userX files"
echo "      Update allowFrom arrays with actual user IDs/emails"


