diff --git a/README.md b/README.md
index 39471a0..f6e6a52 100644
--- a/README.md
+++ b/README.md
@@ -37,8 +37,11 @@ Please note that only TDLight-specific issues are suitable for this repository.
#### Added API Methods
-##### Method `optimize_memory`
-Calling `optimize_memory` will remove old data from the in-memory cache and give the freed memory back to the os
+##### Method `optimizeMemory`
+Calling `optimizeMemory` will remove old data from the in-memory cache and give the freed memory back to the os
+
+##### Method `getMemoryStats`
+Calling `getMemoryStats` will return a json containing the info about the memory manager, more info [here](https://github.com/tdlight-team/tdlight#tdapigetmemorystatistics)
##### Method `getMessageInfo`
Get information about a message
diff --git a/td b/td
index 2b92c16..ec5614f 160000
--- a/td
+++ b/td
@@ -1 +1 @@
-Subproject commit 2b92c16998d39e7bfee580defcb0109151e4fb81
+Subproject commit ec5614fd43c56ba4d6dd7e6a517bc55116ab45cd
diff --git a/telegram-bot-api/Client.cpp b/telegram-bot-api/Client.cpp
index 6ac7b2b..ac6370d 100644
--- a/telegram-bot-api/Client.cpp
+++ b/telegram-bot-api/Client.cpp
@@ -295,6 +295,7 @@ bool Client::init_methods() {
methods_.emplace("deletemessages", &Client::process_delete_messages_query);
methods_.emplace("togglegroupinvites", &Client::process_toggle_group_invites_query);
methods_.emplace("ping", &Client::process_ping_query);
+ methods_.emplace("getmemorystats", &Client::process_get_memory_stats_query);
return true;
@@ -3328,6 +3329,26 @@ class Client::TdOnPingCallback : public TdQueryCallback {
PromisedQueryPtr query_;
};
+class Client::TdOnGetMemoryStatisticsCallback : public TdQueryCallback {
+ public:
+ explicit TdOnGetMemoryStatisticsCallback(PromisedQueryPtr query)
+ : 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));
+ }
+
+ auto res = move_object_as(result);
+
+ answer_query(td::JsonRaw(res->statistics_), std::move(query_));
+ }
+
+ private:
+ PromisedQueryPtr query_;
+};
+
//end custom callbacks impl
void Client::close() {
@@ -7677,8 +7698,13 @@ td::Status Client::process_ping_query(PromisedQueryPtr &query) {
return Status::OK();
}
+td::Status Client::process_get_memory_stats_query(PromisedQueryPtr &query) {
+ send_request(make_object(),
+ std::make_unique(std::move(query)));
+ return Status::OK();
+}
//end custom methods impl
-//start costom auth methods impl
+//start custom auth methods impl
void Client::process_authcode_query(PromisedQueryPtr &query) {
auto code = query->arg("code");
diff --git a/telegram-bot-api/Client.h b/telegram-bot-api/Client.h
index a0760bf..5e8a7d9 100644
--- a/telegram-bot-api/Client.h
+++ b/telegram-bot-api/Client.h
@@ -191,6 +191,7 @@ class Client : public WebhookActor::Callback {
//start custom callbacks
class TdOnPingCallback;
+ class TdOnGetMemoryStatisticsCallback;
//end custom callbacks
void on_get_reply_message(int64 chat_id, object_ptr reply_to_message);
@@ -508,6 +509,7 @@ class Client : public WebhookActor::Callback {
Status process_delete_messages_query(PromisedQueryPtr &query);
Status process_toggle_group_invites_query(PromisedQueryPtr &query);
Status process_ping_query(PromisedQueryPtr &query);
+ Status process_get_memory_stats_query(PromisedQueryPtr &query);
//custom auth methods
void process_authcode_query(PromisedQueryPtr &query);