diff --git a/tdlight-api-openapi.yaml b/tdlight-api-openapi.yaml index 10f0ca5..5b4b595 100644 --- a/tdlight-api-openapi.yaml +++ b/tdlight-api-openapi.yaml @@ -854,90 +854,6 @@ paths: application/json: schema: $ref: '#/components/schemas/Error' - /getNearbyChats: - post: - tags: - - added - - user-only - description: |- - *ONLY FOR USERS* - - Returns a list of chats nearby the specified location. Telegram may send old results if you change your location too quick. - requestBody: - content: - application/x-www-form-urlencoded: - schema: - type: object - properties: - latitude: - description: Latitude of the location - type: number - longitude: - description: Longitude of the location - type: number - horizontal_accuracy: - description: 'The radius of uncertainty for the location, measured in meters; 0-1500' - type: number - required: - - latitude - - longitude - multipart/form-data: - schema: - type: object - properties: - latitude: - description: Latitude of the location - type: number - longitude: - description: Longitude of the location - type: number - horizontal_accuracy: - description: 'The radius of uncertainty for the location, measured in meters; 0-1500' - type: number - required: - - latitude - - longitude - application/json: - schema: - type: object - properties: - latitude: - description: Latitude of the location - type: number - longitude: - description: Longitude of the location - type: number - horizontal_accuracy: - description: 'The radius of uncertainty for the location, measured in meters; 0-1500' - type: number - required: - - latitude - - longitude - required: true - responses: - '200': - description: '' - content: - application/json: - schema: - type: object - properties: - ok: - default: true - type: boolean - result: - type: array - items: - $ref: '#/components/schemas/Chat' - required: - - ok - - result - default: - description: '' - content: - application/json: - schema: - $ref: '#/components/schemas/Error' /searchPublicChats: post: tags: diff --git a/telegram-bot-api/Client.cpp b/telegram-bot-api/Client.cpp index 66def76..e026b37 100644 --- a/telegram-bot-api/Client.cpp +++ b/telegram-bot-api/Client.cpp @@ -374,7 +374,6 @@ bool Client::init_methods() { methods_.emplace("getchats", &Client::process_get_chats_query); methods_.emplace("getcommonchats", &Client::process_get_common_chats_query); methods_.emplace("getinactivechats", &Client::process_get_inactive_chats_query); - methods_.emplace("getnearbychats", &Client::process_get_nearby_chats_query); methods_.emplace("searchpublicchats", &Client::process_search_public_chats_query); methods_.emplace("votepoll", &Client::process_set_poll_answer_query); methods_.emplace("joinchat", &Client::process_join_chat_query); @@ -4760,26 +4759,6 @@ class Client::JsonChats : public td::Jsonable { const Client *client_; }; -class Client::JsonChatsNearby : public td::Jsonable { - public: - JsonChatsNearby(const object_ptr &chats_nearby, const Client *client) - : chats_nearby_(chats_nearby), client_(client) { - } - void store(td::JsonValueScope *scope) const { - auto array = scope->enter_array(); - for (auto &chat : chats_nearby_->users_nearby_) { - array << JsonChat(chat->chat_id_, client_, false, -1, chat->distance_); - } - for (auto &chat : chats_nearby_->supergroups_nearby_) { - array << JsonChat(chat->chat_id_, client_, false, -1, chat->distance_); - } - } - - private: - const object_ptr &chats_nearby_; - const Client *client_; -}; - class Client::JsonMessagesArray : public td::Jsonable { public: explicit JsonMessagesArray(td::vector> &messages, Client *client) : messages_(messages), client_(client) { @@ -6648,27 +6627,6 @@ class Client::TdOnGetChatsCallback : public TdQueryCallback { PromisedQueryPtr query_; }; -class Client::TdOnGetChatsNearbyCallback : public TdQueryCallback { - public: - explicit TdOnGetChatsNearbyCallback(Client *client, PromisedQueryPtr query) - : client_(client), query_(std::move(query)) { - } - - void on_result(object_ptr result) override { - if (result->get_id() == td_api::error::ID) { - return fail_query_with_error(std::move(query_), move_object_as(result)); - } - CHECK(result->get_id() == td_api::chatsNearby::ID); - - auto chats_nearby = move_object_as(result); - answer_query(JsonChatsNearby(chats_nearby, client_), std::move(query_)); - } - - private: - const Client *client_; - PromisedQueryPtr query_; -}; - class Client::TdOnJoinChatCallback : public TdQueryCallback { public: explicit TdOnJoinChatCallback(Client *client, PromisedQueryPtr query, int64 chat_id) @@ -13792,15 +13750,6 @@ td::Status Client::process_get_inactive_chats_query(PromisedQueryPtr &query) { return td::Status::OK(); } -td::Status Client::process_get_nearby_chats_query(PromisedQueryPtr &query) { - CHECK_IS_USER(); - TRY_RESULT(location, get_location(query.get())); - - send_request(make_object(std::move(location)), - td::make_unique(this, std::move(query))); - return td::Status::OK(); -} - td::Status Client::process_search_public_chats_query(PromisedQueryPtr &query) { CHECK_IS_USER(); auto query_ = query->arg("query"); @@ -13867,17 +13816,22 @@ td::Status Client::process_add_chat_member_query(PromisedQueryPtr &query) { td::Status Client::process_report_chat_query(PromisedQueryPtr &query) { CHECK_IS_USER(); + // to be rewritten +/* auto chat_id = query->arg("chat_id"); TRY_RESULT(reason, get_report_reason(query.get())); TRY_RESULT(message_ids, get_int_array_arg(query.get(), "message_ids", true)); check_chat(chat_id, AccessRights::Read, std::move(query), - [this, reason = std::move(reason), message_ids = std::move(message_ids)](int64 chat_id, - PromisedQueryPtr query) mutable { - - send_request(make_object(chat_id, std::move(message_ids), std::move(reason), reason->get_id() == td_api::reportReasonCustom::ID ? query->arg("reason").str() : td::string()), - td::make_unique(std::move(query))); + [this, reason = std::move(reason), message_ids = std::move(message_ids), option_id = std::move(option_id)]( + int64 chat_id, PromisedQueryPtr query) mutable { + send_request( + make_object( + chat_id, option_id, std::move(message_ids), std::move(reason), + reason->get_id() == td_api::reportReasonCustom::ID ? query->arg("reason").str() : td::string()), + td::make_unique(std::move(query))); }); +*/ return td::Status::OK(); } diff --git a/telegram-bot-api/Client.h b/telegram-bot-api/Client.h index 17a18e6..f706803 100644 --- a/telegram-bot-api/Client.h +++ b/telegram-bot-api/Client.h @@ -232,7 +232,6 @@ class Client final : public WebhookActor::Callback { class JsonAuthorizationState; class JsonCallbackQueryAnswer; class JsonChats; - class JsonChatsNearby; class JsonMessagesArray; class JsonFoundMessages; class JsonProxy; @@ -296,7 +295,6 @@ class Client final : public WebhookActor::Callback { class TdOnPingCallback; class TdOnGetMemoryStatisticsCallback; class TdOnGetChatsCallback; - class TdOnGetChatsNearbyCallback; class TdOnJoinChatCallback; class TdOnReturnChatCallback; class TdOnReturnMessagesCallback; @@ -848,7 +846,6 @@ class Client final : public WebhookActor::Callback { td::Status process_get_chats_query(PromisedQueryPtr &query); td::Status process_get_common_chats_query(PromisedQueryPtr &query); td::Status process_get_inactive_chats_query(PromisedQueryPtr &query); - td::Status process_get_nearby_chats_query(PromisedQueryPtr &query); td::Status process_search_public_chats_query(PromisedQueryPtr &query); td::Status process_set_poll_answer_query(PromisedQueryPtr &query); td::Status process_join_chat_query(PromisedQueryPtr &query);