tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.11k stars 1.44k forks source link

Vector path command parameters are missing for stickers #2225

Closed atiyka closed 1 year ago

atiyka commented 1 year ago

I'm requesting the messages in a chat using GetChatHistoryAsync. One of the message's content is a sticker data. I can download the sticker and play the animation, but before that I'd like to display to the user the Outline vector. I receive the following object:

image

So I get a list of VectorPathCommand, any of then has a DataType, for ex. vectorPathCommandCubicBezierCurve. But there are no parameters like start_control_point or end_control_point as the documentations says.

My question is that is this a bug in tdlib? Or I need to call another specific method to get the parameters? I'm using the tdlib in C#.

levlam commented 1 year ago

vectorPathCommandCubicBezierCurve should be a subclass of VectorPathCommand is the binding is correctly generated. There should be a vay to convert array entries to TdApi.VectorPathCommandCubicBezierCurve.

atiyka commented 1 year ago

Okay, and what is the way to convert the array entries? But anyway as you can see from the screenshot in the response received directly from the tdlib, there are no control points at all. Would it be possible that the tdlib has a conversion error when parsing the response from the telegram servers?

levlam commented 1 year ago

that the tdlib has a conversion error when parsing the response from the telegram servers?

No. TDLib API is strictly typed, and can't have fields missing.

Okay, and what is the way to convert the array entries?

You need to check wrapper documentation, or search for the definiton of VectorPathCommandCubicBezierCurve class.

atiyka commented 1 year ago

Thanks for the response. I checked the tdlib code and I found that for creating the Commands array the get_sticker_minithumbnail method is used in StickersManager:1933. The return value type is vector<td_api::object_ptr<td_api::closedVectorPath>> and indeed the values are set correctly. So I move forward to check the C# api.

However I see that there is commented code, which converts the commands to an svg string in StickersManager:2123-2164. Would it be possible to add this code and create a method which returns this information?

levlam commented 1 year ago

The code exists only for testing. App can generate SVG itself, if this is the simplest way to show the outline for you.

atiyka commented 1 year ago

okay thank you