Document limit on the number of identifiers allowed in getCustomEmojiStickers.

This commit is contained in:
levlam 2022-07-26 20:05:48 +03:00
parent 7cdf1a05bb
commit 99b39069a4
2 changed files with 6 additions and 1 deletions

View File

@ -5992,7 +5992,7 @@ getAnimatedEmoji emoji:string = AnimatedEmoji;
//@description Returns an HTTP URL which can be used to automatically log in to the translation platform and suggest new emoji replacements. The URL will be valid for 30 seconds after generation @language_code Language code for which the emoji replacements will be suggested
getEmojiSuggestionsUrl language_code:string = HttpUrl;
//@description Returns list of custom emoji stickers by their identifiers. Stickers are returned in arbitrary order. Only found stickers are returned @custom_emoji_ids Identifiers of custom emoji stickers
//@description Returns list of custom emoji stickers by their identifiers. Stickers are returned in arbitrary order. Only found stickers are returned @custom_emoji_ids Identifiers of custom emoji stickers. At most 200 custom emoji stickers can be received simultaneously
getCustomEmojiStickers custom_emoji_ids:vector<int64> = Stickers;

View File

@ -5216,6 +5216,11 @@ void StickersManager::get_custom_emoji_stickers(vector<int64> &&document_ids, bo
Promise<td_api::object_ptr<td_api::stickers>> &&promise) {
TRY_STATUS_PROMISE(promise, G()->close_status());
constexpr size_t MAX_CUSTOME_EMOJI_IDS = 200; // server-side limit
if (document_ids.size() > MAX_CUSTOME_EMOJI_IDS) {
return promise.set_error(Status::Error(400, "Too many custom emoji identifiers specified"));
}
td::unique(document_ids);
vector<int64> unknown_document_ids;