| name | add-discord |
| command | /add-discord |
| description | Add Discord as a communication channel |
| requiredEnvVars | ["DISCORD_BOT_TOKEN"] |
| requiredTools | ["write_file","read_file","run_code","install_pkg"] |
| platforms | ["linux","macos","windows"] |
| version | 1.0.0 |
| author | betaclaw |
betaclaw Add Discord Skill
You are the Discord integration assistant. Set up a Discord bot as a communication channel for betaclaw.
Step 1: Bot Creation
If the user doesn't have a Discord bot yet:
- Go to https://discord.com/developers/applications
- Click "New Application", name it (e.g., "betaclaw")
- Go to the "Bot" tab, click "Add Bot"
- Under "Privileged Gateway Intents", enable:
- Message Content Intent (required to read message text)
- Server Members Intent (optional, for user identification)
- Copy the bot token from the Bot tab
- Go to "OAuth2" > "URL Generator":
- Scopes:
bot, applications.commands
- Bot Permissions:
Send Messages, Read Message History, Attach Files, Use Slash Commands
- Copy the generated invite URL and open it to add the bot to a server
Step 2: Collect Token
- Prompt the user for their
DISCORD_BOT_TOKEN.
- Store the token in the encrypted vault.
Step 3: Install Dependencies
Run: npm install discord.js
Step 4: Create Channel Adapter
Create src/channels/discord.ts implementing the IChannel interface:
import { Client, GatewayIntentBits, Events } from 'discord.js';
import type { IChannel, InboundMessage, OutboundMessage, ChannelFeature } from './interface.js';
class DiscordChannel implements IChannel {
id = 'discord';
name = 'Discord';
private client: Client;
private messageHandler: ((msg: InboundMessage) => void) | null = null;
constructor(private token: string) {
this.client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.DirectMessages,
],
});
}
async connect(): <> {
..(., {
(msg.. || !.) ;
.({
: msg.,
: msg.,
: msg..,
: msg.,
: msg.,
: msg.?. ?? ,
});
});
..(.);
}
(): <> {
..();
}
(: ): <> {
channel = ...(msg.);
(channel?.() && channel) {
channel.({
: msg.,
: msg. ? { : msg. } : ,
});
}
}
(: ): {
. = handler;
}
(: ): {
: [] = [, , , , ];
supported.(f);
}
}
Adapt to match the project's exact interface and coding conventions.
Step 5: Register Channel
- Add
discord to the enabled channels list in .beta/config.toon.
- Register the channel with the orchestrator.
Step 6: Configure Bot Behavior
Ask the user:
- Trigger mode: Respond to all messages, only when mentioned (
@BotName), or only to specific prefixes.
- Allowed channels: Restrict to specific Discord channel IDs (recommended for security).
- Thread support: Whether to create threads for long conversations.
Step 7: Test Connection
- Log in the bot and verify it connects to Discord's gateway.
- Display the bot's username and discriminator.
- Ask the user to send a test message in a channel the bot has access to.
- Verify the message is received and a response is sent back.
Step 8: Confirm
Report:
- Discord bot is connected and listening
- The bot is active in the servers it's been invited to
- Configured behavior (trigger mode, allowed channels)
- Bot token stored securely in vault
- To manage: use
/customize to adjust Discord settings