Add an AI Assistant to Your Discord Server

Discord bots are everywhere, but most are wrappers around a single API call. No memory, no tools, no ability to actually do things. PocketPaw gives your Discord server a proper AI agent that can search the web, analyze files, generate images, and remember conversations.

This guide gets a PocketPaw-powered Discord bot running in your server.

What You’ll Build

  • /paw slash command for interacting with the AI
  • DM support for private conversations
  • @mention support in channels
  • Streaming responses (edits in real-time as the AI thinks)
  • Persistent memory across conversations
  • Access to 50+ tools (web search, image gen, file handling, and more)

Prerequisites

  • PocketPaw installed (follow the installation guide)
  • A Discord account with permission to add bots to a server
  • An AI provider: Anthropic API key or Ollama

Setting Up the Bot

Create a Discord Application

  1. Go to the Discord Developer Portal
  2. Click “New Application” and give it a name
  3. Go to the Bot section in the sidebar
  4. Click “Reset Token” and copy the bot token

Under Privileged Gateway Intents, enable:

  • Message Content Intent (required for reading messages)

Invite the bot to your server

  1. Go to OAuth2 > URL Generator
  2. Select scopes: bot, applications.commands
  3. Select permissions: Send Messages, Read Message History, Use Slash Commands, Embed Links, Attach Files
  4. Copy the generated URL and open it in your browser
  5. Select your server and authorize

Install the Discord extra

Terminal window
pip install pocketpaw[discord]

Configure environment variables

Terminal window
export POCKETPAW_DISCORD_BOT_TOKEN="your-bot-token"
export POCKETPAW_ANTHROPIC_API_KEY="sk-ant-..." # or use Ollama
# Optional: restrict to specific servers and users
export POCKETPAW_DISCORD_ALLOWED_GUILD_IDS="111222333444"
export POCKETPAW_DISCORD_ALLOWED_USER_IDS="555666777888"

Start PocketPaw

Terminal window
pocketpaw

The web dashboard starts at localhost:8888, and your Discord bot comes online automatically. You can also run headless:

Terminal window
pocketpaw --discord

Test in Discord

  • Type /paw what can you do? in any channel
  • DM the bot directly for private conversations
  • @mention the bot in a channel message

The bot streams its response in real-time, editing the message as new text arrives.

How Streaming Works

Discord has rate limits on message edits (roughly one edit per 1.5 seconds). PocketPaw buffers chunks and updates the message at safe intervals, so responses appear smoothly without hitting rate limits.

Access Control

Control who can use the bot and where:

Terminal window
# Only specific servers
export POCKETPAW_DISCORD_ALLOWED_GUILD_IDS="111222333,444555666"
# Only specific users
export POCKETPAW_DISCORD_ALLOWED_USER_IDS="123456789,987654321"

Without these restrictions, anyone in the server can use the bot. For public communities, setting allowed user IDs is strongly recommended.

Conversation Mode

Let the bot participate naturally in group channels without requiring /paw or @mentions.

Per-channel: Use the /converse slash command in any channel (requires Administrator or Manage Server permission). The bot tracks the last 30 messages and decides when to respond based on context. It stays silent when the conversation isn’t directed at it. Toggle it off the same way, run /converse again.

Server-wide: Enable conversation mode across all channels at once:

Terminal window
export POCKETPAW_DISCORD_CONVERSATION_ALL_CHANNELS=true
# Exclude channels that shouldn't have it (announcements, rules, etc.)
export POCKETPAW_DISCORD_CONVERSATION_EXCLUDE_CHANNEL_IDS="123456789,987654321"

Server Management

The bot can manage your Discord server directly: send messages to channels, create threads, run polls, assign roles, and more. These capabilities are exposed via an MCP server that auto-registers on startup, so they work with any agent backend (Claude, Codex, Gemini, etc.).

The bot keeps its internal tool details hidden from users. When someone asks it to create a poll, it just does it and confirms naturally.

Running Multiple Channels

PocketPaw handles multiple channels from a single instance. Add Telegram alongside Discord:

Terminal window
pip install pocketpaw[telegram,discord]
export POCKETPAW_TELEGRAM_BOT_TOKEN="your-telegram-token"
export POCKETPAW_DISCORD_BOT_TOKEN="your-discord-token"
pocketpaw

Both bots share the same agent, tools, and memory system. A conversation started on Discord can be continued on Telegram (through the shared memory).

Docker Deployment

Prefer containers? A dedicated Discord Docker setup is available with multi-stage builds, Claude Code OAuth support, and Coolify-compatible configuration:

Terminal window
cd deploy/discord
cp .env.example .env
# Edit .env with your bot token and LLM provider
docker compose up -d

See the full Discord Docker Deployment guide for all LLM provider options and volume configuration.

Next Steps