Get the FREE Ultimate OpenClaw Setup Guide →

discord-sync

npx machina-cli add skill lycfyi/community-agent-plugin/discord-sync --openclaw
Files (1)
SKILL.md
3.6 KB

Discord User Token Sync

Syncs messages from Discord servers AND DMs using user token authentication.

When to Use

  • Routed here by community-agent:discord-sync preflight check
  • User explicitly asks for "user token sync"
  • User wants to sync DMs (bots cannot access DMs)
  • User wants rich profile data (bio, pronouns)

When NOT to Use

  • User just says "sync discord" - use community-agent:discord-sync instead (it will route here if appropriate)
  • User wants faster sync with bot token - use discord-bot-connector:discord-sync

Smart Defaults (Reduce Questions)

When user is vague, apply these defaults instead of asking:

User SaysDefault Action
"sync my Discord"Sync the configured default server from agents.yaml
"sync [server name]"Find server by name, sync with 7 days default
No --days specifiedDefault to 7 days
"sync everything"List available servers and ask user to pick

Only ask for clarification when:

  • User's server name matches multiple servers
  • User explicitly asks "which servers can I sync?"

How to Execute

Sync all channels in configured server:

python ${CLAUDE_PLUGIN_ROOT}/tools/discord_sync.py

Sync specific channel:

python ${CLAUDE_PLUGIN_ROOT}/tools/discord_sync.py --channel CHANNEL_ID

Sync specific server:

python ${CLAUDE_PLUGIN_ROOT}/tools/discord_sync.py --server SERVER_ID

Sync with custom history range:

python ${CLAUDE_PLUGIN_ROOT}/tools/discord_sync.py --days 7

Full re-sync (ignore previous sync state):

python ${CLAUDE_PLUGIN_ROOT}/tools/discord_sync.py --full

Sync DMs

DMs are included by default. Use --no-dms to sync servers only.

Sync all (servers + DMs):

python ${CLAUDE_PLUGIN_ROOT}/tools/discord_sync.py

Sync servers only (exclude DMs):

python ${CLAUDE_PLUGIN_ROOT}/tools/discord_sync.py --no-dms

Sync a specific DM by channel ID:

python ${CLAUDE_PLUGIN_ROOT}/tools/discord_sync.py --dm CHANNEL_ID

Sync DMs with custom message limit (default: 100):

python ${CLAUDE_PLUGIN_ROOT}/tools/discord_sync.py --dm-limit 500

DM Message Limits

DM Limit (--dm-limit)

  • Default: 100 (privacy-conscious default)
  • Lower than server channel limit by design
  • Increase manually if needed: --dm-limit 500

Server Channel Limit (--limit)

  • Default: 200 for quick mode
  • Use config file to set higher limits for full sync

Output Location

All paths are relative to cwd (current working directory):

Server Messages

Messages saved to: ./data/{server_id}/{channel_name}/messages.md

Sync state tracked in: ./data/{server_id}/sync_state.yaml

DM Messages

DM messages saved to: ./dms/discord/{user_id}-{username}/messages.md

DM manifest: ./dms/discord/manifest.yaml

Prerequisites

  • ./.env file with DISCORD_USER_TOKEN set (in cwd)
  • ./config/agents.yaml with discord.default_server_id configured (unless using --server flag)

Bot Token Alternative

For faster server message sync with higher rate limits (no DM access), use discord-bot-connector:discord-sync instead.

Incremental Sync

By default, sync is incremental - only new messages since last sync are fetched. Use --full to re-sync all messages within the date range.

Next Steps

After syncing, use discord-read skill to view or search messages.

Source

git clone https://github.com/lycfyi/community-agent-plugin/blob/main/plugins/discord-user-connector/skills/discord-sync/SKILL.mdView on GitHub

Overview

Discord User Token Sync fetches messages from servers and DMs using a user token. It supports DM access that bots cannot reach and can collect rich profile data. Use it when routed by community-agent:discord-sync or when a user explicitly requests user token sync.

How This Skill Works

The tool authenticates with DISCORD_USER_TOKEN and runs discord_sync.py to fetch messages for configured servers (and DMs by default). It stores data locally under data/ for servers and dms/ for DMs, with incremental syncing by default and options like --full to re-sync. You can target a specific channel or server with --channel or --server, and exclude DMs with --no-dms if needed.

When to Use It

  • Routed here by community-agent:discord-sync preflight check
  • User explicitly asks for "user token sync"
  • User wants to sync DMs (bots cannot access DMs)
  • User wants rich profile data (bio, pronouns)
  • User wants incremental sync with a specific history window or a full re-sync

Quick Start

  1. Step 1: Ensure .env contains DISCORD_USER_TOKEN and config/agents.yaml has discord.default_server_id (unless using --server).
  2. Step 2: Run python ${CLAUDE_PLUGIN_ROOT}/tools/discord_sync.py to sync all channels, or add --server SERVER_ID or --channel CHANNEL_ID for targeted sync.
  3. Step 3: Use discord-read to view or search the synced messages.

Best Practices

  • Follow the defaults when user is vague (use the configured default server from agents.yaml).
  • Keep DISCORD_USER_TOKEN secret and store it in a .env file in the cwd.
  • If you only need server messages, use --no-dms to reduce scope and rate limits.
  • Prefer incremental syncing; reserve --full for recovery or complete re-synchronization.
  • Review output paths (data/ and dms/) to ensure privacy and storage constraints are respected.

Example Use Cases

  • Archive all messages from a specific server for compliance by syncing with --server SERVER_ID.
  • Preserve a user's DM history to build a support-friendly conversation record.
  • Perform a full re-sync after updating server/channel configurations with --full.
  • Audit a single channel by syncing with --channel CHANNEL_ID to create a searchable archive.
  • Pair with discord-read to enable fast search over locally stored messages.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers