Skip to main content

Discord bot that uses LLMs to help users with documentation

Project description

discord-llms

A Discord bot that uses LLMs to help users with project documentation. Point it at llms.txt files and let users ask questions in Discord threads.

Features

  • Thread-based conversations: Each question starts a new thread for focused discussion
  • Smart document selection: LLM automatically selects relevant documentation for each question
  • Multi-doc support: Configure multiple documentation sources with summaries
  • OpenAI-compatible API support: Use any OpenAI-compatible provider (OpenRouter, OpenAI, Anthropic, local LLMs, etc.)
  • Tool calling: Uses LLM tool calling to intelligently select documentation

How it works

  1. User mentions the bot with a question: @docs-bot How do I use tool calling?
  2. Bot creates a new thread for the conversation
  3. LLM analyzes the question and selects relevant documentation using tool calling
  4. Bot fetches the selected llms.txt files
  5. LLM answers the question using the documentation context
  6. Follow-up questions in the thread continue the conversation

Installation

Install uv:

Linux/Mac:

curl -LsSf https://astral.sh/uv/install.sh | sh

Windows (PowerShell):

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

Configuration

Configuration File

Download the example configuration file:

Linux/Mac:

curl -o config.yaml https://raw.githubusercontent.com/S1M0N38/discord-llms.txt/main/config/config.example.yaml

Windows (PowerShell):

Invoke-WebRequest -Uri https://raw.githubusercontent.com/S1M0N38/discord-llms.txt/main/config/config.example.yaml -OutFile config.yaml

Discord Bot Setup

  1. Go to Discord Developer Portal
  2. Create a new application
  3. Go to "Bot" section and create a bot
  4. Enable "Message Content Intent" under Privileged Gateway Intents
  5. Copy the bot token (you'll add it to the config file in the next step)
  6. Go to "OAuth2" > "URL Generator"
  7. Select scopes: bot
  8. Select permissions: Send Messages, Create Public Threads, Send Messages in Threads, Read Message History
  9. Use the generated URL to invite the bot to your server

LLM Provider Setup

The bot needs an LLM API to function. Get an API key from one of these providers:

Any OpenAI-compatible API works. You can also use local LLMs with tools like Ollama or LM Studio.

Edit Configuration

Now edit config.yaml with your credentials:

  1. Set bot.token to your Discord bot token (from Discord Bot Setup)
  2. Set model.api_key to your LLM provider API key (from LLM Provider Setup)
  3. Optionally customize model.base_url and model.name for your provider

See the comprehensive comments in config.yaml for all available options and examples.

Usage

uvx discord-llms --config config.yaml

Deploy (Docker)

Build and export an image with your config baked in:

make export CONFIG=path/to/config.yaml TAG=latest

You can also pass the config path positionally:

make export path/to/config.yaml TAG=latest

This creates discord-llms-<tag>.tar. Treat it as sensitive because it contains your secrets.

Load the image:

docker load -i discord-llms-latest.tar

Run it (logs persisted host):

docker run -d --name discord-llms \
  --restart unless-stopped \
  -v /volume1/docker/discord-llms/logs:/app/logs \
  discord-llms:latest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

discord_llms-0.1.0.tar.gz (121.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

discord_llms-0.1.0-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file discord_llms-0.1.0.tar.gz.

File metadata

  • Download URL: discord_llms-0.1.0.tar.gz
  • Upload date:
  • Size: 121.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for discord_llms-0.1.0.tar.gz
Algorithm Hash digest
SHA256 28f6ce807598e8c5af5bdb253a3f8675626fa08e74db8ab35da5be1c8d31e9e4
MD5 4b366b767645bb2a88647e94e349b90d
BLAKE2b-256 772f0bad821d824b91585b3ee0e3552d5a6f0ca523b714c923d620cb1f89b978

See more details on using hashes here.

File details

Details for the file discord_llms-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: discord_llms-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for discord_llms-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9ebf36ecde252b42ed9bf10c1ca1ac02bada7829b13df8c7eb264c2d37a56fc6
MD5 c1902935cc0409e6f03ad867c0d59d4f
BLAKE2b-256 0ba98da5aa4993845054f45378e46a5f98eed004d829ac83179933d446601390

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page