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
- User mentions the bot with a question:
@docs-bot How do I use tool calling? - Bot creates a new thread for the conversation
- LLM analyzes the question and selects relevant documentation using tool calling
- Bot fetches the selected
llms.txtfiles - LLM answers the question using the documentation context
- 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
- Go to Discord Developer Portal
- Create a new application
- Go to "Bot" section and create a bot
- Enable "Message Content Intent" under Privileged Gateway Intents
- Copy the bot token (you'll add it to the config file in the next step)
- Go to "OAuth2" > "URL Generator"
- Select scopes:
bot - Select permissions:
Send Messages,Create Public Threads,Send Messages in Threads,Read Message History - 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:
- OpenRouter: https://openrouter.ai/settings/keys (recommended - supports multiple models including Claude)
- OpenAI: https://platform.openai.com/api-keys
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:
- Set
bot.tokento your Discord bot token (from Discord Bot Setup) - Set
model.api_keyto your LLM provider API key (from LLM Provider Setup) - Optionally customize
model.base_urlandmodel.namefor 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28f6ce807598e8c5af5bdb253a3f8675626fa08e74db8ab35da5be1c8d31e9e4
|
|
| MD5 |
4b366b767645bb2a88647e94e349b90d
|
|
| BLAKE2b-256 |
772f0bad821d824b91585b3ee0e3552d5a6f0ca523b714c923d620cb1f89b978
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ebf36ecde252b42ed9bf10c1ca1ac02bada7829b13df8c7eb264c2d37a56fc6
|
|
| MD5 |
c1902935cc0409e6f03ad867c0d59d4f
|
|
| BLAKE2b-256 |
0ba98da5aa4993845054f45378e46a5f98eed004d829ac83179933d446601390
|