Files
loyal_companion/README.md
2026-01-10 21:46:27 +01:00

3.3 KiB

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 <message> Chat with the bot
/chat <message> Chat via slash command
/search <query> Search the web
/image <query> 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)
  • AI provider API key (OpenAI, OpenRouter, or Anthropic)
  • SearXNG instance (optional, for search)

Installation

  1. Clone the repository:
git clone https://github.com/your-username/Daemon-Boyfriend.git
cd Daemon-Boyfriend
  1. Create a virtual environment:
python -m venv .venv
source .venv/bin/activate  # Linux/Mac
# or: .venv\Scripts\activate  # Windows
  1. Install dependencies:
pip install -r requirements.txt
  1. Configure the bot:
cp .env.example .env
# Edit .env with your tokens
  1. Run the bot:
python -m daemon_boyfriend

Configuration

Edit .env to configure the bot:

# 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)

cp .env.example .env
# Edit .env with your tokens

docker-compose up -d

Bot Only (external SearXNG)

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:

DISCORD_GUILD_ID=123456789012345678

License

MIT