Skip to main content

Discord

Build AI agent bots for Discord — send messages, read channels, list servers, and reply in threads.
Requires the discord.js peer dependency.

Quick Start

import { Agent, openai, DiscordToolkit } from "@radaros/core";

const discord = new DiscordToolkit({
  botToken: process.env.DISCORD_BOT_TOKEN,
});

const agent = new Agent({
  name: "discord-bot",
  model: openai("gpt-4o"),
  instructions: "Help manage Discord server communications.",
  tools: [...discord.getTools()],
});

const result = await agent.run("Read the last 5 messages from channel 1234567890.");

Config

botToken
string
required
Discord bot token. Falls back to DISCORD_BOT_TOKEN env var.

Tools

ToolDescription
discord_send_messageSend a message to a channel.
discord_read_messagesRead recent messages from a channel (up to 100).
discord_list_channelsList text channels in a server (guild).
discord_reply_threadReply to a specific message in a channel or thread.

Peer Dependency

npm install discord.js

Bot Setup

  1. Go to the Discord Developer Portal
  2. Create a new application and add a bot
  3. Enable Message Content Intent under Privileged Gateway Intents
  4. Copy the bot token and set it as DISCORD_BOT_TOKEN
  5. Invite the bot to your server with the bot scope and Send Messages, Read Message History permissions

Environment Variables

VariableDescription
DISCORD_BOT_TOKENDiscord bot token