# Daemon Boyfriend A Discord bot for the MSC group with multi-provider AI chat and SearXNG web search. ## Features - **Multi-Provider AI Chat**: Supports OpenAI, OpenRouter, and Anthropic (Claude) - **Mention-based Chat**: Just @mention the bot to chat - **Web Search**: Privacy-respecting search via SearXNG - **Conversation Memory**: Remembers context per user - **Rate Limiting**: Prevents abuse ## Commands | Command | Description | |---------|-------------| | `@Daemon Boyfriend ` | Chat with the bot | | `/chat ` | Chat via slash command | | `/search ` | Search the web | | `/image ` | Search for images | | `/clear` | Clear your conversation history | | `/status` | Show bot status | | `/help` | Show all commands | ## Quick Start ### Prerequisites - Python 3.11+ - Discord bot token ([Discord Developer Portal](https://discord.com/developers/applications)) - AI provider API key (OpenAI, OpenRouter, or Anthropic) - SearXNG instance (optional, for search) ### Installation 1. Clone the repository: ```bash git clone https://github.com/your-username/Daemon-Boyfriend.git cd Daemon-Boyfriend ``` 2. Create a virtual environment: ```bash python -m venv .venv source .venv/bin/activate # Linux/Mac # or: .venv\Scripts\activate # Windows ``` 3. Install dependencies: ```bash pip install -r requirements.txt ``` 4. Configure the bot: ```bash cp .env.example .env # Edit .env with your tokens ``` 5. Run the bot: ```bash python -m daemon_boyfriend ``` ## Configuration Edit `.env` to configure the bot: ```env # Required DISCORD_TOKEN=your_bot_token # AI Provider (choose one) AI_PROVIDER=openai # or: openrouter, anthropic AI_MODEL=gpt-4o # API Keys (set the one you use) OPENAI_API_KEY=sk-xxx OPENROUTER_API_KEY=sk-or-xxx ANTHROPIC_API_KEY=sk-ant-xxx # SearXNG (optional) SEARXNG_BASE_URL=http://localhost:8080 ``` ### AI Providers | Provider | Models | Notes | |----------|--------|-------| | OpenAI | gpt-4o, gpt-4-turbo, gpt-3.5-turbo | Official OpenAI API | | OpenRouter | 100+ models | Access to Llama, Mistral, Claude, etc. | | Anthropic | claude-3-5-sonnet, claude-3-opus | Direct Claude API | ## Docker Deployment ### With Docker Compose (includes SearXNG) ```bash cp .env.example .env # Edit .env with your tokens docker-compose up -d ``` ### Bot Only (external SearXNG) ```bash docker build -t daemon-boyfriend . docker run -d --env-file .env daemon-boyfriend ``` ## Development ### Project Structure ``` src/daemon_boyfriend/ ├── bot.py # Main bot class ├── config.py # Configuration ├── cogs/ # Command modules │ ├── ai_chat.py # Chat commands │ ├── search.py # Search commands │ └── admin.py # Admin commands ├── services/ # External integrations │ ├── ai_service.py # AI provider factory │ ├── providers/ # AI providers │ ├── searxng.py # SearXNG client │ └── conversation.py # Chat history └── utils/ # Utilities ├── logging.py ├── rate_limiter.py └── error_handler.py ``` ### Running in Development Set `DISCORD_GUILD_ID` in `.env` for faster command sync during development: ```env DISCORD_GUILD_ID=123456789012345678 ``` ## License MIT