feat(cli): import a Discord server into Chatto #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/discord-import"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
chatto operator import discordnow brings a whole Discord server into Chatto:messages, threads, attachments, embeds, reactions, mentions, room groups, and
room placement. A companion export bot produces the bundle from a live server.
The branch merges
main(v0.5.0-beta.19 and later). Its records use the currentnumbering: ADR-117 and FDR-052, because
maintook FDR-051 for roominvitations. The merge keeps both extensions of the historical message import
path: this branch's import-source identity and mention facts, and
main'sthread placement fields.
What's in the branch
Bundle and CLI
mapping.jsonsidecar that maps Discord users to Chatto users and names thetarget.
--all-channelsimports one export per channel;--stream-attachmentsdownloads a file the folder lacks, on the operator's machine. The server never
contacts Discord.
--apply-structurereadsstructure/chatto-plan.jsonand recreates theserver layout: one room group per category, the plan's room name, a universal
room where Discord let every member see the channel, and room members for a
restricted channel.
bot post that carried only an embed still arrives. Both sides take a bundle
path from the URL exactly as the URL spells it.
the operator API request limit.
counted, instead of aborting the channel. A body longer than Chatto allows is
cut and reported.
Server and operator API
ImportBundlein core writes messages with their original time through thehistorical-import path, marks the facts
historical_import, re-hostsattachments, rewrites mentions, and adds one reaction per mapped reactor.
ListRoomGroups,CreateRoomGroup,CreateRoomRequest.universal,ImportCreateChannel.{group_id,universal}, andImportDiscordBundleResponse.messages_skipped_empty.gemoji name, so it matches what the picker writes.
the channel, so an imported history never lands in a room nobody can open.
Export bot (
tools/discord-export-bot/)channels, overwrites, roles, and member-to-role assignments.
the thread export, so an imported thread keeps its first message.
so the export does not contact the third-party site the embed pointed at.
rate-limit pacing, and visible API and waiting totals.
End-to-end evidence
A live Discord server (13 visible channels, 32 mapped users) exported by the bot
and imported into a fresh Chatto instance:
text-channelscreated; the plan'svoice-channelsgroup was not created, because no voice channel has messagesgeneralRead-back through the public ConnectRPC API, signed in as a mapped Discord
author:
name: valuefields, with the embed's poster re-hosted as an attachment(
image/jpeg, 1920x1080, per-user access ticket).thumbnail as an attachment.
rewritten to
@hermes_agent_ff.permission_denied, and the sameuser reads a universal room. The 7 members the import granted can read the
restricted room.
stop_signemoji name.Embeds rendered as text: 3907.A second run of the same import is a no-op for messages and re-applies the
membership grants.
Verification
mise lint-cli: clean.mise test-cli: every package passes.mise license-check: clean.docs-websitecheck: clean.python3 test_discord_export.py: 16 tests pass.Notes for review
MessagePostedEvent.import_source_id= 13marks facts written by an import (ADR-117).
messages_skipped_empty= 10 is anew response counter.
URL spells it. The export writes the bytes there and the import reads from
there; the name Chatto shows is decoded.
42a88f501also removes a__pycache__file that an earlier commit added;133116dbcignores Python bytecode caches.an embed's layout, colour, and buttons; attachment formats the server image
processing rejects; role grants and slow mode from the plan; and whether a
resumed run should add reactions for messages it already imported.
Records
docs/architecture/interfaces.md— the new operator servicesView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.