other

Discord History Exporter Spec

2026-04-16

A local read-only bot-token exporter is the right design. It should use the existing Discord bot credentials already configured for OpenClaw, enumerate channels and threads in guild 1482433153858535656, page message history directly from the Discord API, checkpoint progress, and render one deterministic markdown transcript. Do not use browser scraping, a user token, or an LLM-heavy extraction loop.

Key decisions:

1. Problem Statement and Goal

Pete wants a shareable export of the last 21 days of conversation across the Vinny Discord server, including threads, with no redaction. The existing message tool path works for spot reads, but it is a bad fit for a truthful full-server export because it requires lots of manual pagination, is easy to interrupt, and makes it hard to certify completeness.

The goal is a local scripted exporter that can reliably generate a complete, read-only markdown transcript of a configurable time window from a Discord guild the bot already has access to.

2. Success Metric

This is successful when all of the following are true:

3. Current State

Today:

What is missing:

4. Platform Capabilities

OpenClaw supports Discord as a bot-connected channel and supports reading messages and enumerating threads through the message tool, documented in OpenClaw Discord docs. That is useful for interactive tasks, but it is not the ideal substrate for a full export utility.

Discord itself supports the needed primitives through the API:

Native OpenClaw is enough to confirm access and test spot reads, but a full export requires a custom script/tool layer.

5. Community Patterns

The strongest community patterns are:

  1. Bot-token direct export with pagination
  1. Third-party exporter tools like DiscordChatExporter
  1. Browser/UI scraping

6. Options

OptionApproachComplexityToken CostReliabilityMaintenanceNotes
AKeep using OpenClaw message.read manuallyLow code, high operator burdenLowLowLow code, high painGood for spot checks, bad for full exports
BBuild local Python bot-token exporterMediumNear-zeroHighMediumBest balance of control, safety, and completeness
CAdopt third-party exporter binary/toolLow-mediumNear-zeroMedium-highMedium-highFaster to start, less tailored, more dependency risk

Option A: Manual message.read export

Pros:

Cons:

Option B: Local Python bot-token exporter

Pros:

Cons:

Option C: Third-party exporter

Pros:

Cons:

7. Recommendation

Build Option B: a local Python bot-token exporter.

Why:

Opinionated call: do not build this as an LLM-driven workflow, and do not keep trying to brute-force it with message.read pages in chat.

8. Security Considerations

Access model

Data exposure

Failure modes

Mitigations

9. Implementation Scope

David should build the following:

New files

Output locations

Script responsibilities

  1. Read bot token from existing local OpenClaw config or environment reference.
  2. Enumerate accessible guild channels for a provided guild id.
  3. Enumerate threads, including archived threads where exposed.
  4. Fetch message history per surface with pagination.
  5. Filter to the last --days N window.
  6. Normalize messages into a stable intermediate schema.
  7. Render markdown grouped by channel and nested thread sections.
  8. Write a run summary with counts per channel/thread and any gaps.
  9. Support resume via checkpoint file.

Command-line interface

Proposed CLI:

bash
python3 scripts/discord-export-history.py \
  --guild-id 1482433153858535656 \
  --days 21 \
  --include-threads \
  --output artifacts/vinny_discord_server_export_last_21_days.md \
  --json-out artifacts/tmp/discord-export/latest/messages.jsonl \
  --checkpoint artifacts/tmp/discord-export/latest/checkpoint.json

Message normalization schema

Each normalized message should include:

10. Validation Criteria

David should verify all of the following before calling it done:

  1. Smoke test
  1. High-volume test
  1. Thread test
  1. Resume test
  1. Coverage summary test
  1. Read-only test

11. Category

Tool

This is a new local CLI/data-export capability, not a behavioral tweak or a skill.

12. Context Loading

Load these files when building or maintaining the exporter:

Do not load broad memory files for this tool unless the task changes from implementation to user-context interpretation.

13. Guardrails

14. Handoff

David's final handoff should include:

  1. The implemented script path
  2. Exact command used to run it
  3. The generated markdown artifact path
  4. A short verification summary:
  1. A plain-English note to Pete on whether the export is complete enough to share as-is

Preferred delivery format: