Skip to main content

Documentation Index

Fetch the complete documentation index at: https://vaquill.ai/docs/llms.txt

Use this file to discover all available pages before exploring further.

Run Vaquill inside any Discord server. Members ask legal questions with !ask, the bot replies with cited cases and statutes, and per-channel history keeps follow-ups natural. Source code at github.com/Vaquill-AI/integrations/discord-bot.

Features

  • !ask, !starters, !reset, !help prefix commands (prefix is configurable)
  • Per-channel conversation history (cap configurable, default 20 exchanges)
  • “Show Sources” button on every response reveals cited case law and statutes
  • Long answers paginated with Previous / Next buttons
  • Starter-question buttons via !starters
  • Per-user and per-channel rate limits with optional Redis backend
  • Channel and role allowlists

Prerequisites

  • A Discord account with Manage Server permission on at least one server
  • Python 3.10+ (or Docker)
  • Vaquill API key (starts with vq_key_). See Authentication.

Platform setup

1

Create the application

Open the Discord Developer Portal, click New Application, name it (e.g. “Vaquill Legal AI”), and click Create.
2

Create the bot user and copy the token

In the sidebar, click Bot, then Add Bot > Yes, do it!. Click Reset Token, copy the value, and save it as DISCORD_BOT_TOKEN. You cannot view this token again after leaving the page.
3

Enable Message Content Intent (critical)

On the same Bot page, scroll to Privileged Gateway Intents. Toggle Message Content Intent on and click Save Changes.
Without Message Content Intent the bot cannot read message text and will silently ignore every command. This is the most common cause of “bot online but does nothing”.
4

Generate the invite URL

Go to OAuth2 > URL Generator.Under Scopes check:
  • bot
  • applications.commands
Under Bot Permissions check:
  • Send Messages
  • Embed Links
  • Read Message History
  • Use Slash Commands
  • Add Reactions
Copy the generated URL at the bottom of the page.
5

Invite the bot to your server

Paste the URL into your browser, select the target server, click Authorize, and pass the CAPTCHA. The bot will appear offline in your members list until you start it.

Quickstart

1

Clone and install

git clone https://github.com/Vaquill-AI/integrations.git
cd integrations/discord-bot
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
2

Configure

cp .env.example .env
Fill in:
DISCORD_BOT_TOKEN=your_discord_bot_token
VAQUILL_API_KEY=vq_key_your_api_key_here
VAQUILL_COUNTRY_CODE=US
3

Run

python bot.py
On success you will see VaquillBot has connected to Discord!. In your server, try:
!ask What does FRCP Rule 12(b)(6) require for a motion to dismiss?

Configuration

Top env vars - see the repo’s .env.example for the full set.
VariableRequiredDefaultDescription
DISCORD_BOT_TOKENYes-Bot token from the Developer Portal
VAQUILL_API_KEYYes-Vaquill API key (vq_key_...)
VAQUILL_API_URLNohttps://api.vaquill.ai/api/v1API base URL
VAQUILL_MODENostandardstandard (faster) or deep (more thorough)
VAQUILL_COUNTRY_CODENo-Jurisdiction filter, e.g. US
DISCORD_COMMAND_PREFIXNo!Command prefix
RATE_LIMIT_PER_USERNo10Per-user limit per window
RATE_LIMIT_PER_CHANNELNo30Per-channel limit per window
RATE_LIMIT_WINDOWNo60Sliding window in seconds
ALLOWED_CHANNELSNo-Comma-separated channel IDs (empty = all)
ALLOWED_ROLESNo-Comma-separated role IDs (empty = all)
REDIS_URLNo-Optional Redis URL for distributed rate limiting

Commands

CommandAliasesDescription
!ask <question>!a, !qAsk a legal question; supports follow-ups via channel history
!starters!start, !questionsShow starter questions as clickable buttons
!reset-Clear conversation history for the current channel
!help-Show the help menu

Deployment

Docker

docker build -t vaquill-discord-bot .
docker run -d --name vaquill-discord-bot --env-file .env vaquill-discord-bot
docker logs -f vaquill-discord-bot
For Compose, create a minimal docker-compose.yml:
services:
  bot:
    build: .
    restart: unless-stopped
    env_file: .env
Then docker compose up -d.

Cloud hosts

Railway

railway init && railway up. Set DISCORD_BOT_TOKEN and VAQUILL_API_KEY in the Variables tab.

Render

New Web Service. Build: pip install -r requirements.txt. Start: python bot.py.

VPS + systemd

Run under a systemd unit with Restart=always. The bot does not need an open port.

Fly.io

fly launch, set secrets, fly deploy. Discord uses long-poll so no public URL is required.
Example systemd unit:
[Unit]
Description=Vaquill Discord Bot
After=network.target

[Service]
Type=simple
User=botuser
WorkingDirectory=/opt/vaquill-discord-bot
ExecStart=/opt/vaquill-discord-bot/venv/bin/python bot.py
EnvironmentFile=/opt/vaquill-discord-bot/.env
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

Troubleshooting

SymptomFix
Bot is offlineCheck DISCORD_BOT_TOKEN. Confirm python bot.py is running. On free cloud tiers, confirm the service is not sleeping.
Bot online but ignores commandsEnable Message Content Intent in the Developer Portal and restart. Confirm you are using the correct prefix (default !).
”Privileged intent provided is not enabled or whitelisted” on startupEnable Message Content Intent in the Developer Portal.
”Missing Permissions” errorRe-invite the bot with the URL from the OAuth2 step. Or grant Send Messages / Embed Links / Read Message History on the bot’s role.
API errors (“Sorry, I couldn’t process your request”)Verify VAQUILL_API_KEY. Confirm VAQUILL_API_URL is reachable. If using deep mode, confirm your plan supports it.
Rate-limit messages too quicklyRaise RATE_LIMIT_PER_USER or RATE_LIMIT_WINDOW in .env.

Slack

Slash commands and Socket Mode equivalent.

Telegram

Lightest setup - BotFather only.

Chatbots overview

Compare all six platforms.

Authentication

How Vaquill API keys work.