go-tl-parser icon indicating copy to clipboard operation
go-tl-parser copied to clipboard

Parser v2 still cannot unmarshal correctly.

Open c0re100 opened this issue 2 years ago • 2 comments

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.

c0re100 avatar Nov 10 '21 23:11 c0re100

Another cannot unmarshal method: SearchStickerSet and affecting all sticker method json: cannot unmarshal object into Go struct field ClosedVectorPath.thumbnail_outline.commands of type tdlib.VectorPathCommand

Reproduce code:

	set, err := client.SearchStickerSet("SeriaKureru")
	if err != nil {
		fmt.Println(err.Error())
		return
	}

c0re100 avatar Dec 18 '21 20:12 c0re100

Another cannot unmarshal method: GetWebPageInstantView json: cannot unmarshal object into Go struct field .page_blocks of type tdlib.PageBlock

Reproduce code:

	page, err := client.GetWebPageInstantView("https://twitter.com/siragagaga/status/1483043827741249541",  true)
	if err != nil {
		fmt.Println(err.Error())
		return
	}

c0re100 avatar Jan 24 '22 19:01 c0re100