This commit introduces a new command `borg collect discord import` to import and archive Discord server exports. The command processes a JSON export from tools like DiscordChatExporter, converts the messages into Markdown files organized by channel, downloads all attachments to create a self-contained archive, and generates a searchable `INDEX.json` file. Key features: - Parses DiscordChatExporter JSON format. - Converts chat logs to Markdown, preserving metadata. - Downloads and localizes all message attachments. - Creates a searchable `INDEX.json`. - Sanitizes server and channel names to prevent path traversal. Co-authored-by: Snider <631881+Snider@users.noreply.github.com>
59 lines
1.1 KiB
JSON
59 lines
1.1 KiB
JSON
{
|
|
"guild": {
|
|
"id": "12345",
|
|
"name": "Test/Server"
|
|
},
|
|
"channels": [
|
|
{
|
|
"id": "channel1",
|
|
"name": "general"
|
|
},
|
|
{
|
|
"id": "channel2",
|
|
"name": "random"
|
|
}
|
|
],
|
|
"messages": [
|
|
{
|
|
"id": "msg1",
|
|
"channelId": "channel1",
|
|
"author": {
|
|
"id": "user1",
|
|
"name": "Jules",
|
|
"avatarUrl": ""
|
|
},
|
|
"timestamp": "2024-01-01T12:00:00Z",
|
|
"content": "Hello, world!",
|
|
"attachments": []
|
|
},
|
|
{
|
|
"id": "msg2",
|
|
"channelId": "channel2",
|
|
"author": {
|
|
"id": "user2",
|
|
"name": "User2",
|
|
"avatarUrl": ""
|
|
},
|
|
"timestamp": "2024-01-01T12:01:00Z",
|
|
"content": "This is a test message.",
|
|
"attachments": [
|
|
{
|
|
"url": "https://example.com/file.txt",
|
|
"fileName": "file with spaces.txt"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "msg3",
|
|
"channelId": "channel1",
|
|
"author": {
|
|
"id": "user1",
|
|
"name": "Jules",
|
|
"avatarUrl": ""
|
|
},
|
|
"timestamp": "2024-01-01T12:02:00Z",
|
|
"content": "Another message in general.",
|
|
"attachments": []
|
|
}
|
|
]
|
|
}
|