Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API 7.2] Issues with Mixed-Format Sticker Packs #564

Closed
sergix44 opened this issue Apr 3, 2024 · 7 comments
Closed

[API 7.2] Issues with Mixed-Format Sticker Packs #564

sergix44 opened this issue Apr 3, 2024 · 7 comments

Comments

@sergix44
Copy link

sergix44 commented Apr 3, 2024

Hi!
I'm one of the nutgram mantainers, while upgrading the framework to support the latest changes, we noticed a bunch of issues related to the new mixed format stickers:

Added the field format to the class InputSticker.

Backwards compatibility has been broken:
image
Idk, might intented to be this way, but if yes, than doesnt make any sense why is not required while adding a sticker to a set:
image

But a bigger issue is that the API accepts stickers that doesn't match the specified format (are also displayed correctly):
image

So, seems the API does not care what format contains, but only requires the format parameter to be present in the request 🤔

Added the parameter format to the method setStickerSetThumbnail.

Same here, backwards compatibility has been broken, and a bunch of random errors are given for different combinations of input parameters:
image
image
But when format is specified, seems to work fine:
image

cc @Lukasss93

@levlam
Copy link
Contributor

levlam commented Apr 3, 2024

Backward compatibility wasn't broken. Since Bot API 7.2 the field format in InputSticker is mandatory and must be always specified, but you don't pass it. Previously, createNewStickerSet had mandatory parameter sticker_format. You don't pass it either, therefore the request is invalid and isn't expected to succeed.

The format field is required in all methods, including addStickerToSet and setStickerSetThumbnail. If you failed to specify it or specified an incorrect value, then it is hardly possible to predict effect of the request. It can succeed, fail, or succeed, but add a broken sticker to the set.

@Lukasss93
Copy link

Okay, I see what you mean.

  • If an old bot has always used the createNewStickerSet method with the sticker_format field, the API will continue to work the same way.
    The important thing is that either the sticker_format field or the format field is set inside the InputSticker.
  • As for the addStickerToSet method, even though the format parameter is mandatory as you say, it actually works even if it is not passed.
  • Finally, the setStickerSetThumbnail method no longer works for old bots that use this method, because the format parameter is now mandatory, which is a breaking change.
Method API 7.1 API 7.2 Breaking change?
createNewStickerSet
sticker_format:✅

stickers.*.format:❌

sticker_format:❌

stickers.*.format:✅

NO
addStickerToSet sticker.format:❌ sticker.format:❔optional NO
setStickerSetThumbnail format:❌ format:✅
⚠️ YES

@sergix44
Copy link
Author

sergix44 commented Apr 4, 2024

Backward compatibility wasn't broken. Since Bot API 7.2 the field format in InputSticker is mandatory and must be always specified, but you don't pass it. Previously, createNewStickerSet had mandatory parameter sticker_format. You don't pass it either, therefore the request is invalid and isn't expected to succeed.

The format field is required in all methods, including addStickerToSet and setStickerSetThumbnail. If you failed to specify it or specified an incorrect value, then it is hardly possible to predict effect of the request. It can succeed, fail, or succeed, but add a broken sticker to the set.

Yep you right about the the createNewStickerSet call, my bad.
But the other stuff is still valid, so in addition the the @Lukasss93 's summary above, what I wanted to point out are the misleading error messages that the api returns in these cases, as well as the lack of validation with respect to the consistency between the uploaded file and the format field.

@levlam
Copy link
Contributor

levlam commented Apr 4, 2024

As for the addStickerToSet method, even though the format parameter is mandatory as you say, it actually works even if it is not passed.

It doesn't always work. It can work in some cases for backward compatibility for old bots. The parameter format is mandatory in InputSticker and must be always passed to ensure that the bot correctly works with mixed-format sticker packs.

setStickerSetThumbnail works for old bots as it worked previously. Backward compatibility is enforced by Bot API and there were no backward compatibility breaking changes for requests in Bot API 7.2.

@Lukasss93
Copy link

Lukasss93 commented Apr 4, 2024

I got it. Thank you 😊

@sergix44
Copy link
Author

sergix44 commented Apr 4, 2024

Thanks

@sergix44 sergix44 closed this as completed Apr 4, 2024
@Sithusoelwin35
Copy link

Yesterday the Telegram team released Bot API 7.2. This update brings many changes, which we are already working on implementing.

However there is one major backward incompatible change, which is the removal of the fields StickerSet.is_animated/is_video. This unfortunately breaks the method Bot.get_sticker_set and affects all versions of our library. The current workaround for this if you have v20.8+ is to directly call
await bot.do_api_request("get_sticker_set", {"name": sticker_set_name})
and parse the resulting JSON return value. The upcoming version of the library will address this incompatibility.

Thank you for understanding and being patient.

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

No branches or pull requests

4 participants