Skip to main content

Documentation Index

Fetch the complete documentation index at: https://arivu.mintlify.app/llms.txt

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

What the backend needs

The Discord adapter in integrations/discord_adapter.py uses discord.py and supports both slash commands and message-based queries. Required values:
  • DISCORD_BOT_TOKEN or token
  • Optional DISCORD_GUILD_ID for faster slash command sync
  • Optional admin_user_ids for approval gating
  • Enable the Message Content Intent in the Discord developer portal

What Discord users can do

Slash Commands

Use /query to ask a question and /refresh to refresh schema.

DM Queries

Send a direct message to the bot and get a response back in DM.

Prefix Queries

In a server, use the !dh prefix for text queries when you do not want slash commands.

Approvals and RLHF

Approve / Reject destructive SQL and capture 👍 / 👎 feedback with buttons.

Setup steps

1

Create a Discord application

Create a bot in the Discord Developer Portal.
2

Enable intents and permissions

Turn on Message Content Intent and grant bot permissions to send messages, read messages, use slash commands, add reactions, and read message history.
3

Invite the bot

Add the bot to your server using the OAuth2 invite URL.
4

Set environment variables

Set DISCORD_BOT_TOKEN and optionally DISCORD_GUILD_ID for quicker slash command syncing.
5

Add admins

Pass Discord user IDs in admin_user_ids so approval prompts only go to trusted users.

Example

from arivu.integrations.discord_adapter import DiscordIntegration

adapter = DiscordIntegration(
    db=db,
    token="your-discord-bot-token",
    guild_id=123456789012345678,
    admin_user_ids=[123456789012345678],
)

adapter.start()

Backend behavior

  • Session IDs are mapped as discord:{user_id}.
  • Slash command /query runs a natural language query.
  • Slash command /refresh refreshes the schema cache.
  • DM messages and !dh prefix messages route through the same pipeline.
  • Approval messages are delivered as Discord UI buttons.
  • RLHF is stored via the 👍 / 👎 buttons on response messages.
Discord is a good fit when you want both server chat and DM support with a richer button-based experience.