mirror of
https://github.com/tdlight-team/tdlight-telegram-bot-api.git
synced 2025-01-26 19:57:33 +01:00
Add Client::get_sticker_input_file.
This commit is contained in:
parent
401894a53b
commit
bb5f3651b2
@ -6804,6 +6804,14 @@ td::Result<td::vector<td_api::object_ptr<td_api::inputSticker>>> Client::get_inp
|
|||||||
return std::move(stickers);
|
return std::move(stickers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
td::Result<td_api::object_ptr<td_api::InputFile>> Client::get_sticker_input_file(const Query *query) {
|
||||||
|
auto file_id = trim(query->arg("sticker"));
|
||||||
|
if (file_id.empty()) {
|
||||||
|
return Status::Error(400, "Sticker is not specified");
|
||||||
|
}
|
||||||
|
return make_object<td_api::inputFileRemote>(file_id.str());
|
||||||
|
}
|
||||||
|
|
||||||
td::Result<td::string> Client::get_passport_element_hash(Slice encoded_hash) {
|
td::Result<td::string> Client::get_passport_element_hash(Slice encoded_hash) {
|
||||||
if (!td::is_base64(encoded_hash)) {
|
if (!td::is_base64(encoded_hash)) {
|
||||||
return Status::Error(400, "hash isn't a valid base64-encoded string");
|
return Status::Error(400, "hash isn't a valid base64-encoded string");
|
||||||
@ -9248,25 +9256,18 @@ td::Status Client::process_set_custom_emoji_sticker_set_thumbnail_query(Promised
|
|||||||
}
|
}
|
||||||
|
|
||||||
td::Status Client::process_set_sticker_position_in_set_query(PromisedQueryPtr &query) {
|
td::Status Client::process_set_sticker_position_in_set_query(PromisedQueryPtr &query) {
|
||||||
auto file_id = trim(query->arg("sticker"));
|
TRY_RESULT(input_file, get_sticker_input_file(query.get()));
|
||||||
if (file_id.empty()) {
|
|
||||||
return Status::Error(400, "Sticker is not specified");
|
|
||||||
}
|
|
||||||
int32 position = get_integer_arg(query.get(), "position", -1);
|
int32 position = get_integer_arg(query.get(), "position", -1);
|
||||||
|
|
||||||
send_request(
|
send_request(make_object<td_api::setStickerPositionInSet>(std::move(input_file), position),
|
||||||
make_object<td_api::setStickerPositionInSet>(make_object<td_api::inputFileRemote>(file_id.str()), position),
|
|
||||||
td::make_unique<TdOnOkQueryCallback>(std::move(query)));
|
td::make_unique<TdOnOkQueryCallback>(std::move(query)));
|
||||||
return Status::OK();
|
return Status::OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
td::Status Client::process_delete_sticker_from_set_query(PromisedQueryPtr &query) {
|
td::Status Client::process_delete_sticker_from_set_query(PromisedQueryPtr &query) {
|
||||||
auto file_id = trim(query->arg("sticker"));
|
TRY_RESULT(input_file, get_sticker_input_file(query.get()));
|
||||||
if (file_id.empty()) {
|
|
||||||
return Status::Error(400, "Sticker is not specified");
|
|
||||||
}
|
|
||||||
|
|
||||||
send_request(make_object<td_api::removeStickerFromSet>(make_object<td_api::inputFileRemote>(file_id.str())),
|
send_request(make_object<td_api::removeStickerFromSet>(std::move(input_file)),
|
||||||
td::make_unique<TdOnOkQueryCallback>(std::move(query)));
|
td::make_unique<TdOnOkQueryCallback>(std::move(query)));
|
||||||
return Status::OK();
|
return Status::OK();
|
||||||
}
|
}
|
||||||
|
@ -414,6 +414,8 @@ class Client final : public WebhookActor::Callback {
|
|||||||
td::Result<td::vector<object_ptr<td_api::inputSticker>>> get_input_stickers(
|
td::Result<td::vector<object_ptr<td_api::inputSticker>>> get_input_stickers(
|
||||||
const Query *query, object_ptr<td_api::StickerFormat> &sticker_format) const;
|
const Query *query, object_ptr<td_api::StickerFormat> &sticker_format) const;
|
||||||
|
|
||||||
|
static td::Result<object_ptr<td_api::InputFile>> get_sticker_input_file(const Query *query);
|
||||||
|
|
||||||
static td::Result<td::string> get_passport_element_hash(Slice encoded_hash);
|
static td::Result<td::string> get_passport_element_hash(Slice encoded_hash);
|
||||||
|
|
||||||
static td::Result<object_ptr<td_api::InputPassportElementErrorSource>> get_passport_element_error_source(
|
static td::Result<object_ptr<td_api::InputPassportElementErrorSource>> get_passport_element_error_source(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user