From agent-messenger
Interact with Discord servers via CLI: send/read messages, list channels/servers/users, snapshot, manage reactions/auth. For AI agents automating Discord tasks.
npx claudepluginhub agent-messenger/agent-messenger --plugin agent-channeltalkbotThis skill is limited to using the following tools:
A TypeScript CLI tool that enables AI agents and humans to interact with Discord servers through a simple command interface. Features seamless token extraction from the Discord desktop app (with browser fallback) and multi-server support.
Creates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
A TypeScript CLI tool that enables AI agents and humans to interact with Discord servers through a simple command interface. Features seamless token extraction from the Discord desktop app (with browser fallback) and multi-server support.
# Get server snapshot (credentials are extracted automatically)
agent-discord snapshot
# Send a message
agent-discord message send <channel-id> "Hello from AI agent!"
# List channels
agent-discord channel list
Credentials are extracted automatically from the Discord desktop app (or Chromium browser as fallback) on first use. No manual setup required — just run any command and authentication happens silently in the background.
On macOS, the system may prompt for your Keychain password the first time (required to decrypt Discord's stored token). This is a one-time prompt.
IMPORTANT: Always use agent-discord auth extract to obtain tokens. The CLI extracts from the desktop app first, falling back to Chromium browsers if the app isn't installed.
# List all available servers
agent-discord server list
# Switch to a different server
agent-discord server switch <server-id>
# Show current server
agent-discord server current
# Check auth status
agent-discord auth status
The agent maintains a ~/.config/agent-messenger/MEMORY.md file as persistent memory across sessions. This is agent-managed — the CLI does not read or write this file. Use the Read and Write tools to manage your memory file.
At the start of every task, read ~/.config/agent-messenger/MEMORY.md using the Read tool to load any previously discovered server IDs, channel IDs, user IDs, and preferences.
After discovering useful information, update ~/.config/agent-messenger/MEMORY.md using the Write tool. Write triggers include:
server list, snapshot, etc.)channel list, snapshot, etc.)user list, user me, etc.)When writing, include the complete file content — the Write tool overwrites the entire file.
Never store tokens, credentials, or any sensitive data. Never store full message content (just IDs and channel context). Never store file upload contents.
If a memorized ID returns an error (channel not found, server not found), remove it from MEMORY.md. Don't blindly trust memorized data — verify when something seems off. Prefer re-listing over using a memorized ID that might be stale.
# Agent Messenger Memory
## Discord Servers
- `1234567890123456` — Acme Dev (default)
- `9876543210987654` — Open Source Community
## Channels (Acme Dev)
- `1111111111111111` — #general (General category)
- `2222222222222222` — #engineering (Engineering category)
- `3333333333333333` — #deploys (Engineering category)
## Users (Acme Dev)
- `4444444444444444` — Alice (server owner)
- `5555555555555555` — Bob
## Aliases
- "dev server" → `1234567890123456` (Acme Dev)
- "deploys" → `3333333333333333` (#deploys in Acme Dev)
## Notes
- User prefers --pretty output for snapshots
- Main server is "Acme Dev"
Memory lets you skip repeated
channel listandserver listcalls. When you already know an ID from a previous session, use it directly.
# Extract token from Discord desktop app or browser (usually automatic)
agent-discord auth extract
agent-discord auth extract --debug
# Check auth status
agent-discord auth status
# Logout from Discord
agent-discord auth logout
# Show current authenticated user
agent-discord whoami
agent-discord whoami --pretty
Output includes the authenticated user's identity information.
# Send a message
agent-discord message send <channel-id> <content>
agent-discord message send 1234567890123456789 "Hello world"
# List messages
agent-discord message list <channel-id>
agent-discord message list 1234567890123456789 --limit 50
# Get a single message by ID
agent-discord message get <channel-id> <message-id>
agent-discord message get 1234567890123456789 9876543210987654321
# Delete a message
agent-discord message delete <channel-id> <message-id> --force
# Acknowledge/mark a message as read
agent-discord message ack <channel-id> <message-id>
# Search messages in current server
agent-discord message search <query>
agent-discord message search "project update" --limit 10
agent-discord message search "hello" --channel <channel-id> --author <user-id>
# List channels in current server (text channels only)
agent-discord channel list
# Get channel info
agent-discord channel info <channel-id>
agent-discord channel info 1234567890123456789
# Get channel history (alias for message list)
agent-discord channel history <channel-id> --limit 100
# List all servers
agent-discord server list
# Get server info
agent-discord server info <server-id>
# Switch active server
agent-discord server switch <server-id>
# Show current server
agent-discord server current
# List server members
agent-discord user list
# Get user info
agent-discord user info <user-id>
# Get current user
agent-discord user me
# List DM channels
agent-discord dm list
# Create a DM channel with a user
agent-discord dm create <user-id>
# List recent mentions
agent-discord mention list
agent-discord mention list --limit 50
agent-discord mention list --guild <server-id>
# List all relationships (friends, blocked, pending requests)
agent-discord friend list
agent-discord friend list --pretty
# Get note for a user
agent-discord note get <user-id>
# Set note for a user
agent-discord note set <user-id> "Note content"
# Get detailed user profile
agent-discord profile get <user-id>
# Search guild members
agent-discord member search <guild-id> <query>
agent-discord member search 1234567890123456789 "john" --limit 20
# Create a thread in a channel
agent-discord thread create <channel-id> <name>
agent-discord thread create 1234567890123456789 "Discussion" --auto-archive-duration 1440
# Archive a thread
agent-discord thread archive <thread-id>
# Add reaction (use emoji name without colons)
agent-discord reaction add <channel-id> <message-id> <emoji>
agent-discord reaction add 1234567890123456789 9876543210987654321 thumbsup
# Remove reaction
agent-discord reaction remove <channel-id> <message-id> <emoji>
# List reactions on a message
agent-discord reaction list <channel-id> <message-id>
# Upload file
agent-discord file upload <channel-id> <path>
agent-discord file upload 1234567890123456789 ./report.pdf
# List files in channel
agent-discord file list <channel-id>
# Get file info
agent-discord file info <channel-id> <file-id>
Get server overview for AI agents (brief by default):
# Brief snapshot (default) — fast, minimal API calls
agent-discord snapshot
# Full snapshot — includes messages and members (slow, large output)
agent-discord snapshot --full
# Filtered full snapshots
agent-discord snapshot --full --channels-only
agent-discord snapshot --full --users-only
# Limit messages per channel (only with --full)
agent-discord snapshot --full --limit 10
Default returns brief JSON with:
With --full, returns comprehensive JSON with:
All commands output JSON by default for AI consumption:
{
"id": "1234567890123456789",
"content": "Hello world",
"author": "username",
"timestamp": "2024-01-15T10:30:00.000Z"
}
Use --pretty flag for formatted output:
agent-discord channel list --pretty
| Feature | Discord | Slack |
|---|---|---|
| Server terminology | Server | Workspace |
| Channel identifiers | Snowflake IDs | Channel name or ID |
| Message identifiers | Snowflake IDs | Timestamps (ts) |
| Threads | Thread ID field | Thread timestamp |
| Mentions | <@user_id> | <@USER_ID> |
Important: Discord uses Snowflake IDs (large numbers like 1234567890123456789) for all identifiers. You cannot use channel names directly - use channel list to find IDs first.
See references/common-patterns.md for typical AI agent workflows.
See templates/ directory for runnable examples:
post-message.sh - Send messages with error handlingmonitor-channel.sh - Monitor channel for new messagesserver-summary.sh - Generate server summaryAll commands return consistent error format:
{
"error": "Not authenticated. Run \"auth extract\" first."
}
Common errors:
Not authenticated: No valid token (auto-extraction failed — see Troubleshooting)No current server set: Run server switch <id> firstMessage not found: Invalid message IDUnknown Channel: Invalid channel IDCredentials stored in ~/.config/agent-messenger/discord-credentials.json (0600 permissions). See references/authentication.md for format and security details.
DiscordClient is available as a TypeScript SDK for building scripts and automations.
import { DiscordClient } from 'agent-messenger/discord'
const client = await new DiscordClient().login()
Or with manual credential management:
import { DiscordClient, DiscordCredentialManager } from 'agent-messenger/discord'
const manager = new DiscordCredentialManager()
const token = await manager.getToken()
if (!token) {
throw new Error('Discord token not found. Run auth extract first.')
}
const client = await new DiscordClient().login({ token })
// Send a message
const msg = await client.sendMessage(channelId, 'Hello from SDK!')
// React to it
await client.addReaction(channelId, msg.id, '👋')
// Search messages
const { results } = await client.searchMessages(serverId, 'deployment', {
sortBy: 'timestamp',
sortOrder: 'desc',
limit: 5,
})
// Create a thread
const thread = await client.createThread(channelId, 'Discussion Topic')
await client.sendMessage(thread.id, 'First message in thread')
DiscordListener connects to Discord's Gateway WebSocket for instant event streaming:
import { DiscordClient, DiscordListener, DiscordIntent } from 'agent-messenger/discord'
const client = await new DiscordClient().login()
const listener = new DiscordListener(client, {
intents: DiscordIntent.Guilds | DiscordIntent.GuildMessages | DiscordIntent.MessageContent,
})
listener.on('message_create', (event) => {
console.log(`${event.author.username}: ${event.content}`)
})
listener.on('error', (err) => console.error(err))
await listener.start()
// listener.stop()
Available events: message_create, message_update, message_delete, message_reaction_add, message_reaction_remove, guild_member_add, guild_member_remove, typing_start, presence_update, channel_create, channel_update, channel_delete, discord_event (catch-all), connected, disconnected, error.
Note: MessageContent, GuildMembers, and GuildPresences are privileged intents — pass them explicitly via options.intents.
See the Discord SDK documentation for complete method signatures, types, schemas, and examples.
agent-discord: command not foundagent-discord is NOT the npm package name. The npm package is agent-messenger.
If the package is installed globally, use agent-discord directly:
agent-discord server list
If the package is NOT installed, use npx -y by default. Do NOT ask the user which package runner to use — just run it:
npx -y agent-messenger discord server list
bunx agent-messenger discord server list
pnpm dlx agent-messenger discord server list
If you already know the user's preferred package runner (e.g.,
bunx,pnpm dlx), use that instead.
NEVER run npx agent-discord, bunx agent-discord, or pnpm dlx agent-discord — it will fail or install a wrong package since agent-discord is not the npm package name.
For other troubleshooting (auth extraction, token issues, permissions), see references/authentication.md.