Skip to content

Parser v2 still cannot unmarshal correctly. #5

@c0re100

Description

@c0re100

It's affecting SearchPublicChat and GetChat method.
Maybe it's same issue like #1

code:

chat, err := client.SearchPublicChat("tg_x64")
if err != nil {
    fmt.Println(err.Error())
    return
}

Error message:
json: cannot unmarshal object into Go struct field .last_message of type tdlib.MessageSender

Reason:
Since a public channel with linked group is allow an user reply without join group,
after SearchPublicChat, we can receive chat JSON like this

        "interaction_info": {
            "@type": "messageInteractionInfo",
            "view_count": 1,
            "forward_count": 1,
            "reply_info": {
                "@type": "messageReplyInfo",
                "reply_count": 1,
                "recent_repliers": [{
                        "@type": "messageSenderUser",
                        "user_id": 123456789
                    }
                ],
                "last_read_inbox_message_id": 0,
                "last_read_outbox_message_id": 0,
                "last_message_id": 1048576
            }
        }

ref: https://github.com/tdlib/td/blob/v1.7.0/td/generate/scheme/td_api.tl#L721

But interaction_info do not have UnmarshalJSON method to handle multiple messageSenderUser, so go-tdlib can't parse correctly and return the error.
It's easy to reproduce on my example code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions