Return Ok from setStickerSetThumbnail.
This commit is contained in:
parent
c3d2ad8c59
commit
ba2c797350
@ -7993,17 +7993,17 @@ checkStickerSetName name:string = CheckStickerSetNameResult;
|
||||
createNewStickerSet user_id:int53 title:string name:string sticker_format:StickerFormat sticker_type:StickerType needs_repainting:Bool stickers:vector<inputSticker> source:string = StickerSet;
|
||||
|
||||
|
||||
//@description Adds a new sticker to a set; for bots only. Returns the sticker set
|
||||
//@description Adds a new sticker to a set; for bots only
|
||||
//@user_id Sticker set owner
|
||||
//@name Sticker set name
|
||||
//@sticker Sticker to add to the set
|
||||
addStickerToSet user_id:int53 name:string sticker:inputSticker = Ok;
|
||||
|
||||
//@description Sets a sticker set thumbnail; for bots only. Returns the sticker set
|
||||
//@description Sets a sticker set thumbnail; for bots only
|
||||
//@user_id Sticker set owner
|
||||
//@name Sticker set name
|
||||
//@thumbnail Thumbnail to set in PNG, TGS, or WEBM format; pass null to remove the sticker set thumbnail. Thumbnail format must match the format of stickers in the set
|
||||
setStickerSetThumbnail user_id:int53 name:string thumbnail:InputFile = StickerSet;
|
||||
setStickerSetThumbnail user_id:int53 name:string thumbnail:InputFile = Ok;
|
||||
|
||||
//@description Sets a custom emoji sticker set thumbnail; for bots only
|
||||
//@name Sticker set name
|
||||
|
@ -1219,11 +1219,10 @@ class AddStickerToSetQuery final : public Td::ResultHandler {
|
||||
};
|
||||
|
||||
class SetStickerSetThumbnailQuery final : public Td::ResultHandler {
|
||||
Promise<td_api::object_ptr<td_api::stickerSet>> promise_;
|
||||
Promise<Unit> promise_;
|
||||
|
||||
public:
|
||||
explicit SetStickerSetThumbnailQuery(Promise<td_api::object_ptr<td_api::stickerSet>> &&promise)
|
||||
: promise_(std::move(promise)) {
|
||||
explicit SetStickerSetThumbnailQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send(const string &short_name, tl_object_ptr<telegram_api::InputDocument> &&input_document) {
|
||||
@ -1245,7 +1244,7 @@ class SetStickerSetThumbnailQuery final : public Td::ResultHandler {
|
||||
if (!sticker_set_id.is_valid()) {
|
||||
return on_error(Status::Error(500, "Sticker set not found"));
|
||||
}
|
||||
promise_.set_value(td_->stickers_manager_->get_sticker_set_object(sticker_set_id));
|
||||
promise_.set_value(Unit());
|
||||
}
|
||||
|
||||
void on_error(Status status) final {
|
||||
@ -8541,8 +8540,7 @@ void StickersManager::on_added_sticker_uploaded(int64 random_id, Result<Unit> re
|
||||
}
|
||||
|
||||
void StickersManager::set_sticker_set_thumbnail(UserId user_id, string short_name,
|
||||
tl_object_ptr<td_api::InputFile> &&thumbnail,
|
||||
Promise<td_api::object_ptr<td_api::stickerSet>> &&promise) {
|
||||
tl_object_ptr<td_api::InputFile> &&thumbnail, Promise<Unit> &&promise) {
|
||||
TRY_RESULT_PROMISE(promise, input_user, td_->contacts_manager_->get_input_user(user_id));
|
||||
|
||||
short_name = clean_username(strip_empty_characters(short_name, MAX_STICKER_SET_SHORT_NAME_LENGTH));
|
||||
@ -8571,7 +8569,7 @@ void StickersManager::set_sticker_set_thumbnail(UserId user_id, string short_nam
|
||||
|
||||
void StickersManager::do_set_sticker_set_thumbnail(UserId user_id, string short_name,
|
||||
tl_object_ptr<td_api::InputFile> &&thumbnail,
|
||||
Promise<td_api::object_ptr<td_api::stickerSet>> &&promise) {
|
||||
Promise<Unit> &&promise) {
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
const StickerSet *sticker_set = get_sticker_set(short_name_to_sticker_set_id_.get(short_name));
|
||||
|
@ -309,7 +309,7 @@ class StickersManager final : public Actor {
|
||||
Promise<Unit> &&promise);
|
||||
|
||||
void set_sticker_set_thumbnail(UserId user_id, string short_name, tl_object_ptr<td_api::InputFile> &&thumbnail,
|
||||
Promise<td_api::object_ptr<td_api::stickerSet>> &&promise);
|
||||
Promise<Unit> &&promise);
|
||||
|
||||
void set_custom_emoji_sticker_set_thumbnail(string short_name, CustomEmojiId custom_emoji_id,
|
||||
Promise<Unit> &&promise);
|
||||
@ -546,7 +546,7 @@ class StickersManager final : public Actor {
|
||||
struct PendingSetStickerSetThumbnail {
|
||||
string short_name_;
|
||||
FileId file_id_;
|
||||
Promise<td_api::object_ptr<td_api::stickerSet>> promise_;
|
||||
Promise<Unit> promise_;
|
||||
};
|
||||
|
||||
struct PendingGetAnimatedEmojiClickSticker {
|
||||
@ -880,7 +880,7 @@ class StickersManager final : public Actor {
|
||||
void on_sticker_set_thumbnail_uploaded(int64 random_id, Result<Unit> result);
|
||||
|
||||
void do_set_sticker_set_thumbnail(UserId user_id, string short_name, tl_object_ptr<td_api::InputFile> &&thumbnail,
|
||||
Promise<td_api::object_ptr<td_api::stickerSet>> &&promise);
|
||||
Promise<Unit> &&promise);
|
||||
|
||||
void do_set_custom_emoji_sticker_set_thumbnail(string short_name, CustomEmojiId custom_emoji_id,
|
||||
Promise<Unit> &&promise);
|
||||
|
@ -7303,7 +7303,7 @@ void Td::on_request(uint64 id, td_api::addStickerToSet &request) {
|
||||
void Td::on_request(uint64 id, td_api::setStickerSetThumbnail &request) {
|
||||
CHECK_IS_BOT();
|
||||
CLEAN_INPUT_STRING(request.name_);
|
||||
CREATE_REQUEST_PROMISE();
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
stickers_manager_->set_sticker_set_thumbnail(UserId(request.user_id_), std::move(request.name_),
|
||||
std::move(request.thumbnail_), std::move(promise));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user