diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 86a923d37..8f6719c16 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -5303,8 +5303,8 @@ setBotUpdatesStatus pending_update_count:int32 error_message:string = Ok; //@user_id Sticker file owner @png_sticker PNG image with the sticker; must be up to 512 KB in size and fit in 512x512 square uploadStickerFile user_id:int32 png_sticker:InputFile = File; -//@description Creates a new sticker set; for bots only. Returns the newly created sticker set -//@user_id Sticker set owner +//@description Creates a new sticker set. Returns the newly created sticker set +//@user_id Sticker set owner; ignored for regular users //@title Sticker set title; 1-64 characters //@name Sticker set name. Can contain only English letters, digits and underscores. Must end with *"_by_"* (** is case insensitive); 1-64 characters //@is_masks True, if stickers are masks. Animated stickers can't be masks diff --git a/td/telegram/StickersManager.cpp b/td/telegram/StickersManager.cpp index a359dfde4..37bc6e98f 100644 --- a/td/telegram/StickersManager.cpp +++ b/td/telegram/StickersManager.cpp @@ -4720,6 +4720,10 @@ tl_object_ptr StickersManager::get_input_stic void StickersManager::create_new_sticker_set(UserId user_id, string &title, string &short_name, bool is_masks, vector> &&stickers, Promise &&promise) { + bool is_bot = td_->auth_manager_->is_bot(); + if (!is_bot) { + user_id = td_->contacts_manager_->get_my_id(); + } auto input_user = td_->contacts_manager_->get_input_user(user_id); if (input_user == nullptr) { return promise.set_error(Status::Error(3, "User not found")); diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 6503816e9..bd4dfcb91 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -7039,7 +7039,6 @@ void Td::on_request(uint64 id, td_api::uploadStickerFile &request) { } void Td::on_request(uint64 id, td_api::createNewStickerSet &request) { - CHECK_IS_BOT(); CLEAN_INPUT_STRING(request.title_); CLEAN_INPUT_STRING(request.name_); CREATE_REQUEST(CreateNewStickerSetRequest, request.user_id_, std::move(request.title_), std::move(request.name_), diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index 0ae9ca9f2..fd7409cdc 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -433,7 +433,7 @@ class CliClient final : public Actor { static char get_delimiter(Slice str) { std::unordered_set chars; for (auto c : trim(str)) { - if (!is_alnum(c) && c != '-') { + if (!is_alnum(c) && c != '-' && c != '.' && c != '/') { chars.insert(c); } } @@ -2412,6 +2412,18 @@ class CliClient final : public Actor { string category; get_args(args, chat_id, category); send_request(td_api::make_object(get_top_chat_category(category), as_chat_id(chat_id))); + } else if (op == "cnss") { + string title; + string name; + string stickers; + get_args(args, title, name, stickers); + auto input_stickers = + transform(full_split(stickers, get_delimiter(stickers)), + [](string sticker) -> td_api::object_ptr { + return td_api::make_object(as_input_file(sticker), "😀", nullptr); + }); + send_request( + td_api::make_object(my_id_, title, name, false, std::move(input_stickers))); } else if (op == "sss") { send_request(td_api::make_object(args)); } else if (op == "siss") { @@ -3167,9 +3179,8 @@ class CliClient final : public Actor { vector attached_files; get_args(args, chat_id, message_file, args); attached_files = full_split(args); - send_request(td_api::make_object( - as_chat_id(chat_id), as_input_file(message_file), - transform(attached_files, [](const string &attached_file) { return as_input_file(attached_file); }))); + send_request(td_api::make_object(as_chat_id(chat_id), as_input_file(message_file), + transform(attached_files, as_input_file))); } else if (op == "em") { string chat_id; string message_id;