Skip to content

feat: include message sender ID in the message export#1075

Open
zebrapurring wants to merge 1 commit intoiyear:masterfrom
zebrapurring:export-sender-id
Open

feat: include message sender ID in the message export#1075
zebrapurring wants to merge 1 commit intoiyear:masterfrom
zebrapurring:export-sender-id

Conversation

@zebrapurring
Copy link
Copy Markdown

This change includes the sender ID in the message export when using --with-content.

@XMLHexagram
Copy link
Copy Markdown
Collaborator

Looks good, but why we need this? I think users can find sender id in raw message.

@zebrapurring
Copy link
Copy Markdown
Author

Looks good, but why we need this? I think users can find sender id in raw message.

That's true, however I find it useful to have the sender ID by default. When downloading many messages the raw field adds a lot of noise in my opinion.

But of course it's just a convenience change.

@XMLHexagram
Copy link
Copy Markdown
Collaborator

Cause this PR is some kind of convenience/taste changes, I need owner's options.

@iyear what's your idea?

@iyear
Copy link
Copy Markdown
Owner

iyear commented Nov 9, 2025

@zebrapurring tg.PeerClass is a Go interface that contains type and id information. However, when it is converted to JSON, the type information is lost. I suggest creating a new model to convert PeerClass into a structured object

Like:

type PeerClass string

type Peer struct {
    Type PeerClass `json:"type"`
    ID int64 `json:"id"`
}

@zebrapurring
Copy link
Copy Markdown
Author

@zebrapurring tg.PeerClass is a Go interface that contains type and id information. However, when it is converted to JSON, the type information is lost. I suggest creating a new model to convert PeerClass into a structured object

Like:

type PeerClass string

type Peer struct {
    Type PeerClass `json:"type"`
    ID int64 `json:"id"`
}

From what I can see the type information is actually included when serializing the field:

{
    "id": 1234,
    "type": "message",
    "file": "file.jpg",
    "sender": {
        "UserID": 123456
    },
    "date": 1764714525,
    "text": "Hello"
},

@zebrapurring
Copy link
Copy Markdown
Author

zebrapurring commented Apr 3, 2026

@iyear @XMLHexagram any chance to merge this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants