This commit introduces a new command, `borg collect telegram import`, which allows users to import and archive Telegram channel and group exports. The new functionality includes: - A new `telegram` subcommand under the `collect` command. - An `import` command that parses Telegram Desktop JSON exports. - Conversion of messages to Markdown, with support for rich text formatting, replies, and forwards. - Preservation of media files, which are stored in a `media` subdirectory. - Organization of messages into monthly Markdown files for easy navigation. - Creation of an `INDEX.json` file to store the original export metadata. The feature is accompanied by unit tests to ensure its correctness and reliability. Co-authored-by: Snider <631881+Snider@users.noreply.github.com>
42 lines
820 B
JSON
42 lines
820 B
JSON
{
|
|
"name": "Test Channel",
|
|
"type": "public_channel",
|
|
"id": 123456789,
|
|
"messages": [
|
|
{
|
|
"id": 1,
|
|
"type": "message",
|
|
"date": "2024-01-15T12:00:00",
|
|
"from": "User1",
|
|
"text": "Hello, world!"
|
|
},
|
|
{
|
|
"id": 2,
|
|
"type": "message",
|
|
"date": "2024-01-15T12:01:00",
|
|
"from": "User2",
|
|
"text": [
|
|
{
|
|
"type": "bold",
|
|
"text": "This"
|
|
},
|
|
" is a ",
|
|
{
|
|
"type": "italic",
|
|
"text": "test"
|
|
},
|
|
" message with formatting."
|
|
]
|
|
},
|
|
{
|
|
"id": 3,
|
|
"type": "message",
|
|
"date": "2024-02-10T18:30:00",
|
|
"from": "User1",
|
|
"photo": "photos/photo_1@10-02-2024_18-30-00.jpg",
|
|
"width": 800,
|
|
"height": 600,
|
|
"text": "Here is a photo."
|
|
}
|
|
]
|
|
}
|