From fad2128779137160bdc9b398d19c09dad3ee9d64 Mon Sep 17 00:00:00 2001 From: b1tflyyyy Date: Mon, 6 May 2024 06:18:50 -0400 Subject: [PATCH 1/6] added syn/ant funcs & response depth --- .../english_words_info_api_controller.cpp | 70 +++++++++++++++++-- .../english_words_info_api_controller.hpp | 6 ++ 2 files changed, 71 insertions(+), 5 deletions(-) diff --git a/source/business_logic/controller/api/english_words_info_api/english_words_info_api_controller.cpp b/source/business_logic/controller/api/english_words_info_api/english_words_info_api_controller.cpp index 51162ea..c890655 100644 --- a/source/business_logic/controller/api/english_words_info_api/english_words_info_api_controller.cpp +++ b/source/business_logic/controller/api/english_words_info_api/english_words_info_api_controller.cpp @@ -42,11 +42,71 @@ AEnglish_Words_Info_API_Controller::~AEnglish_Words_Info_API_Controller() // --------------------------------------------------------------------------------------------------------------------- std::optional AEnglish_Words_Info_API_Controller::Get_Definition(const std::string& word) +{ + if (!Send_Request(word, "/definitions", "GET")) + { + return std::nullopt; + } + + std::string response{}; + response.reserve(500); + + for (std::size_t i{}; i < Max_Response_Depth && !Json_Response["definitions"][i].empty(); ++i) + { + response += Json_Response["definitions"][i]["definition"]; + response += "\n\n"; + } + + return response; +} + +// --------------------------------------------------------------------------------------------------------------------- +std::optional AEnglish_Words_Info_API_Controller::Get_Antonym(const std::string& word) +{ + if (!Send_Request(word, "/antonyms", "GET")) + { + return std::nullopt; + } + + std::string response{}; + response.reserve(500); + + for (std::size_t i{}; i < Max_Response_Depth && !Json_Response["antonyms"][i].empty(); ++i) + { + response += Json_Response["antonyms"][i]; + response += "\n"; + } + + return response; +} + +// --------------------------------------------------------------------------------------------------------------------- +std::optional AEnglish_Words_Info_API_Controller::Get_Synonym(const std::string& word) +{ + if (!Send_Request(word, "/synonyms", "GET")) + { + return std::nullopt; + } + + std::string response{}; + response.reserve(500); + + for (std::size_t i{}; i < Max_Response_Depth && !Json_Response["synonyms"][i].empty(); ++i) + { + response += Json_Response["synonyms"][i]; + response += "\n"; + } + + return response; +} + +// --------------------------------------------------------------------------------------------------------------------- +bool AEnglish_Words_Info_API_Controller::Send_Request(std::string_view word, std::string_view endpoint, std::string_view request_type) { if (Curl = curl_easy_init(); Curl != nullptr) { - curl_easy_setopt(Curl, CURLOPT_URL, (Url + word).data()); - curl_easy_setopt(Curl, CURLOPT_CUSTOMREQUEST, "GET"); + curl_easy_setopt(Curl, CURLOPT_URL, (Url + word.data() + endpoint.data()).data()); + curl_easy_setopt(Curl, CURLOPT_CUSTOMREQUEST, request_type.data()); curl_easy_setopt(Curl, CURLOPT_HTTPHEADER, Headers); curl_easy_setopt(Curl, CURLOPT_WRITEFUNCTION, &ABase_API_Controller::Write_Callback); curl_easy_setopt(Curl, CURLOPT_WRITEDATA, &AEnglish_Words_Info_API_Controller::Json_Response); @@ -58,11 +118,11 @@ std::optional AEnglish_Words_Info_API_Controller::Get_Definition(co curl_easy_cleanup(Curl); - if (resp_code != EHTTP_STATUS::OK || Json_Response["results"][0]["definition"].empty()) + if (resp_code != EHTTP_STATUS::OK) { - return std::nullopt; + return false; } } - return Json_Response["results"][0]["definition"]; + return Curl != nullptr; } \ No newline at end of file diff --git a/source/business_logic/controller/api/english_words_info_api/english_words_info_api_controller.hpp b/source/business_logic/controller/api/english_words_info_api/english_words_info_api_controller.hpp index c853d8a..4cdcb8f 100644 --- a/source/business_logic/controller/api/english_words_info_api/english_words_info_api_controller.hpp +++ b/source/business_logic/controller/api/english_words_info_api/english_words_info_api_controller.hpp @@ -36,8 +36,14 @@ class AEnglish_Words_Info_API_Controller : public ABase_API_Controller ~AEnglish_Words_Info_API_Controller() override; std::optional Get_Definition(const std::string& word); + std::optional Get_Antonym(const std::string& word); + std::optional Get_Synonym(const std::string& word); private: + bool Send_Request(std::string_view word, std::string_view endpoint, std::string_view request_type); + +private: + constexpr static std::size_t Max_Response_Depth{ 10 }; static nljson Json_Response; curl_slist* Headers; }; \ No newline at end of file From 39e3b0f86e64bea9b914761e225e75d2b2812695 Mon Sep 17 00:00:00 2001 From: b1tflyyyy Date: Mon, 6 May 2024 06:21:24 -0400 Subject: [PATCH 2/6] added new commands and replies --- .../message_commands/message_commands.cpp | 4 ++- .../message_commands/message_commands.hpp | 2 ++ .../texts/message_reply/message_reply.cpp | 28 +++++++++++++++++-- .../texts/message_reply/message_reply.hpp | 4 +++ 4 files changed, 35 insertions(+), 3 deletions(-) diff --git a/source/view/texts/message_commands/message_commands.cpp b/source/view/texts/message_commands/message_commands.cpp index 61514be..2e0f8b3 100644 --- a/source/view/texts/message_commands/message_commands.cpp +++ b/source/view/texts/message_commands/message_commands.cpp @@ -33,4 +33,6 @@ constinit std::string_view SMessage_Commands::About_Project{ "about_project" }; constinit std::string_view SMessage_Commands::Definiton{ "def" }; constinit std::string_view SMessage_Commands::Metrics_Range{"metrics_range" }; constinit std::string_view SMessage_Commands::Get_Metrics{ "get_metrics" }; -constinit std::string_view SMessage_Commands::Get_Best_Metric{ "get_best_metric" }; \ No newline at end of file +constinit std::string_view SMessage_Commands::Get_Best_Metric{ "get_best_metric" }; +constinit std::string_view SMessage_Commands::Get_Antonym{ "ant" }; +constinit std::string_view SMessage_Commands::Get_Synonym{ "syn" }; \ No newline at end of file diff --git a/source/view/texts/message_commands/message_commands.hpp b/source/view/texts/message_commands/message_commands.hpp index 802c4e3..ee8172b 100644 --- a/source/view/texts/message_commands/message_commands.hpp +++ b/source/view/texts/message_commands/message_commands.hpp @@ -38,4 +38,6 @@ struct SMessage_Commands constinit static std::string_view Metrics_Range; constinit static std::string_view Get_Metrics; constinit static std::string_view Get_Best_Metric; + constinit static std::string_view Get_Antonym; + constinit static std::string_view Get_Synonym; }; \ No newline at end of file diff --git a/source/view/texts/message_reply/message_reply.cpp b/source/view/texts/message_reply/message_reply.cpp index 2b8a7f6..2bb00de 100644 --- a/source/view/texts/message_reply/message_reply.cpp +++ b/source/view/texts/message_reply/message_reply.cpp @@ -80,13 +80,13 @@ std::string AMessage_Reply::Get_Info_About_Project_Msg() // --------------------------------------------------------------------------------------------------------------------- std::string AMessage_Reply::Get_Word_Definition_Msg(std::string_view primary_word, std::string_view definiton) { - return std::format("Визначення слова {}:\n{} - {}", primary_word, primary_word, definiton); + return std::format("Визначення слова {}:\n\n{}", primary_word, definiton); } // --------------------------------------------------------------------------------------------------------------------- std::string AMessage_Reply::Get_Not_Found_Word_Definition_Msg() { - return std::format("Скоріш за все ти ввів дивне слово, я не можу знайти визначення для нього)"); + return std::string{ "Скоріш за все ти ввів дивне слово, я не можу знайти визначення для нього)" }; } // --------------------------------------------------------------------------------------------------------------------- @@ -105,4 +105,28 @@ std::string AMessage_Reply::Get_Metrics_Msg(const SMetrics& metrics) std::string AMessage_Reply::Get_Limit_Api_Requests_Msg() { return std::string{ "Нажаль ліміт запросів перевищено!\nСпробуйте пізніше)" }; +} + +// --------------------------------------------------------------------------------------------------------------------- +std::string AMessage_Reply::Get_Antonym_Msg(std::string_view primary_word, std::string_view antonym) +{ + return std::format("Антоніми до слова {}:\n\n{}", primary_word, antonym); +} + +// --------------------------------------------------------------------------------------------------------------------- +std::string AMessage_Reply::Get_Not_Found_Antonym_Msg() +{ + return std::string{ "Мені не вдалося знайти антонім до твого слова) " }; +} + +// --------------------------------------------------------------------------------------------------------------------- +std::string AMessage_Reply::Get_Synonym_Msg(std::string_view primary_word, std::string_view synonym) +{ + return std::format("Синонім до слова {}:\n\n{}", primary_word, synonym); +} + +// --------------------------------------------------------------------------------------------------------------------- +std::string AMessage_Reply::Get_Not_Found_Synonym_Msg() +{ + return std::string{ "Мені не вдалося знайти синонім до твого слова) " }; } \ No newline at end of file diff --git a/source/view/texts/message_reply/message_reply.hpp b/source/view/texts/message_reply/message_reply.hpp index aec224c..23f94fe 100644 --- a/source/view/texts/message_reply/message_reply.hpp +++ b/source/view/texts/message_reply/message_reply.hpp @@ -55,4 +55,8 @@ class AMessage_Reply static std::string Get_Metrics_Range_Msg(const std::pair& metrics_range); static std::string Get_Metrics_Msg(const SMetrics& metrics); static std::string Get_Limit_Api_Requests_Msg(); + static std::string Get_Antonym_Msg(std::string_view primary_word, std::string_view antonym); + static std::string Get_Not_Found_Antonym_Msg(); + static std::string Get_Synonym_Msg(std::string_view primary_word, std::string_view synonym); + static std::string Get_Not_Found_Synonym_Msg(); }; \ No newline at end of file From 67dc2ba30eae1996a0873abd760e483d444bd683 Mon Sep 17 00:00:00 2001 From: b1tflyyyy Date: Mon, 6 May 2024 06:23:10 -0400 Subject: [PATCH 3/6] added new commands --- .../message_handler/message_handler.cpp | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/source/view/handlers/message_handler/message_handler.cpp b/source/view/handlers/message_handler/message_handler.cpp index 7318077..c0fd689 100644 --- a/source/view/handlers/message_handler/message_handler.cpp +++ b/source/view/handlers/message_handler/message_handler.cpp @@ -125,6 +125,42 @@ void AMessage_Handler::Bind_Commands() TG_Bot.getApi().sendMessage(message->chat->id, AMessage_Reply::Get_Not_Found_Word_Definition_Msg()); }); + TG_Bot.getEvents().onCommand(SMessage_Commands::Get_Antonym.data(), [this](TgBot::Message::Ptr message) -> void + { + if (!Words_Api_Requests_Limiter.Can_Send_Request()) + { + TG_Bot.getApi().sendMessage(message->chat->id, AMessage_Reply::Get_Limit_Api_Requests_Msg()); + return; + } + + Cut_User_Input(message->text, SMessage_Commands::Get_Antonym.size()); + if (auto response{ English_Words_API_Controller.Get_Antonym(message->text) }; response != std::nullopt) + { + TG_Bot.getApi().sendMessage(message->chat->id, + AMessage_Reply::Get_Antonym_Msg(message->text, response.value())); + return; + } + + TG_Bot.getApi().sendMessage(message->chat->id, AMessage_Reply::Get_Not_Found_Antonym_Msg()); + }); + TG_Bot.getEvents().onCommand(SMessage_Commands::Get_Synonym.data(), [this](TgBot::Message::Ptr message) -> void + { + if (!Words_Api_Requests_Limiter.Can_Send_Request()) + { + TG_Bot.getApi().sendMessage(message->chat->id, AMessage_Reply::Get_Limit_Api_Requests_Msg()); + return; + } + + Cut_User_Input(message->text, SMessage_Commands::Get_Synonym.size()); + if (auto response{ English_Words_API_Controller.Get_Synonym(message->text) }; response != std::nullopt) + { + TG_Bot.getApi().sendMessage(message->chat->id, + AMessage_Reply::Get_Synonym_Msg(message->text, response.value())); + return; + } + + TG_Bot.getApi().sendMessage(message->chat->id, AMessage_Reply::Get_Not_Found_Synonym_Msg()); + }); TG_Bot.getEvents().onCommand(SMessage_Commands::Metrics_Range.data(), [this](TgBot::Message::Ptr message) -> void { if (!Is_Root_User(message->from->id)) From 25fdc1e572f4c0550ea88e788a8c844ec85f1d10 Mon Sep 17 00:00:00 2001 From: b1tflyyyy Date: Mon, 6 May 2024 12:15:00 -0400 Subject: [PATCH 4/6] added metrics for new commands --- .../controller/db/metrics_db/metrics_db_controller.cpp | 10 +++++----- source/business_logic/model/metrics/metrics_model.cpp | 10 ++++++---- source/business_logic/model/metrics/metrics_model.hpp | 5 ++++- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/source/business_logic/controller/db/metrics_db/metrics_db_controller.cpp b/source/business_logic/controller/db/metrics_db/metrics_db_controller.cpp index 1900792..7993707 100644 --- a/source/business_logic/controller/db/metrics_db/metrics_db_controller.cpp +++ b/source/business_logic/controller/db/metrics_db/metrics_db_controller.cpp @@ -31,14 +31,14 @@ AMetrics_DB_Controller::AMetrics_DB_Controller(const ADB_Config& db_cfg) : // --------------------------------------------------------------------------------------------------------------------- void AMetrics_DB_Controller::Set_Metrics(const SMetrics& metrics) { - Exec_Query(std::format(R"(INSERT INTO {} (start_req, profile_req, pr_game_req, math_game_req, help_req, about_project_req, definition_req, date, total_number_of_requests) VALUES ('{}', '{}', '{}', '{}', '{}', '{}', '{}', '{}', '{}'))", Table_Name, metrics.Start_Request_Count, metrics.Profile_Request_Count, metrics.Pr_Game_Request_Count, metrics.Math_Game_Request_Count, metrics.Help_Request_Count, metrics.About_Project_Request_Count, metrics.Definition_Request_Count, metrics.Get_Current_Date(), metrics.Get_Total_Number_Of_Requests())); + Exec_Query(std::format(R"(INSERT INTO {} (start_req, profile_req, pr_game_req, math_game_req, help_req, about_project_req, definition_req, date, total_number_of_requests, antonym_req, synonym_req) VALUES ('{}', '{}', '{}', '{}', '{}', '{}', '{}', '{}', '{}', '{}', '{}'))", Table_Name, metrics.Start_Request_Count, metrics.Profile_Request_Count, metrics.Pr_Game_Request_Count, metrics.Math_Game_Request_Count, metrics.Help_Request_Count, metrics.About_Project_Request_Count, metrics.Definition_Request_Count, metrics.Get_Current_Date(), metrics.Get_Total_Number_Of_Requests(), metrics.Antonym_Request_Count, metrics.Synonym_Request_Count)); } // --------------------------------------------------------------------------------------------------------------------- SMetrics AMetrics_DB_Controller::Get_Metrics(std::int64_t metrics_id) { - auto response{ Exec_Query(std::format(R"(SELECT start_req, profile_req, pr_game_req, math_game_req, help_req, about_project_req, definition_req, date FROM {} WHERE id = '{}')", Table_Name, metrics_id)) }; - return SMetrics{ response[0][0].as(), response[0][1].as(), response[0][2].as(), response[0][3].as(), response[0][4].as(), response[0][5].as(), response[0][6].as(), response[0][7].as() }; + auto response{ Exec_Query(std::format(R"(SELECT start_req, profile_req, pr_game_req, math_game_req, help_req, about_project_req, definition_req, antonym_req, synonym_req, date FROM {} WHERE id = '{}')", Table_Name, metrics_id)) }; + return SMetrics{ response[0][0].as(), response[0][1].as(), response[0][2].as(), response[0][3].as(), response[0][4].as(), response[0][5].as(), response[0][6].as(), response[0][7].as(), response[0][8].as(), response[0][9].as() }; } // --------------------------------------------------------------------------------------------------------------------- @@ -51,6 +51,6 @@ std::pair AMetrics_DB_Controller::Get_Metrics_Range( // --------------------------------------------------------------------------------------------------------------------- SMetrics AMetrics_DB_Controller::Get_Best_Metrics() { - auto response{ Exec_Query(std::format(R"(SELECT start_req, profile_req, pr_game_req, math_game_req, help_req, about_project_req, definition_req, date FROM {} WHERE total_number_of_requests = (SELECT MAX(total_number_of_requests) FROM {}))", Table_Name, Table_Name)) }; - return SMetrics{ response[0][0].as(), response[0][1].as(), response[0][2].as(), response[0][3].as(), response[0][4].as(), response[0][5].as(), response[0][6].as(), response[0][7].as() }; + auto response{ Exec_Query(std::format(R"(SELECT start_req, profile_req, pr_game_req, math_game_req, help_req, about_project_req, definition_req, antonym_req, synonym_req, date FROM {} WHERE total_number_of_requests = (SELECT MAX(total_number_of_requests) FROM {}))", Table_Name, Table_Name)) }; + return SMetrics{ response[0][0].as(), response[0][1].as(), response[0][2].as(), response[0][3].as(), response[0][4].as(), response[0][5].as(), response[0][6].as(), response[0][7].as(), response[0][8].as(),response[0][9].as() }; } \ No newline at end of file diff --git a/source/business_logic/model/metrics/metrics_model.cpp b/source/business_logic/model/metrics/metrics_model.cpp index b0643d8..ea0f6e2 100644 --- a/source/business_logic/model/metrics/metrics_model.cpp +++ b/source/business_logic/model/metrics/metrics_model.cpp @@ -25,12 +25,12 @@ // --------------------------------------------------------------------------------------------------------------------- SMetrics::SMetrics() : - Start_Request_Count{}, Profile_Request_Count{}, Pr_Game_Request_Count{}, Math_Game_Request_Count{}, Help_Request_Count{}, About_Project_Request_Count{}, Definition_Request_Count{}, Current_Date{} + Start_Request_Count{}, Profile_Request_Count{}, Pr_Game_Request_Count{}, Math_Game_Request_Count{}, Help_Request_Count{}, About_Project_Request_Count{}, Definition_Request_Count{}, Antonym_Request_Count{}, Synonym_Request_Count{}, Current_Date{} { } // --------------------------------------------------------------------------------------------------------------------- -SMetrics::SMetrics(std::int64_t start_request_count, std::int64_t profile_request_count, std::int64_t pr_game_request_count, std::int64_t math_game_request_count, std::int64_t help_request_count, std::int64_t about_project_request_count, std::int64_t definition_request_count, std::string current_date) : - Start_Request_Count{ start_request_count }, Profile_Request_Count{ profile_request_count }, Pr_Game_Request_Count{ pr_game_request_count }, Math_Game_Request_Count{ math_game_request_count }, Help_Request_Count{ help_request_count }, About_Project_Request_Count{ about_project_request_count }, Definition_Request_Count{ definition_request_count }, Current_Date{ std::move(current_date) } +SMetrics::SMetrics(std::int64_t start_request_count, std::int64_t profile_request_count, std::int64_t pr_game_request_count, std::int64_t math_game_request_count, std::int64_t help_request_count, std::int64_t about_project_request_count, std::int64_t definition_request_count, std::int64_t antonym_request_count, std::int64_t synonym_request_count, std::string current_date) : + Start_Request_Count{ start_request_count }, Profile_Request_Count{ profile_request_count }, Pr_Game_Request_Count{ pr_game_request_count }, Math_Game_Request_Count{ math_game_request_count }, Help_Request_Count{ help_request_count }, About_Project_Request_Count{ about_project_request_count }, Definition_Request_Count{ definition_request_count }, Antonym_Request_Count{ antonym_request_count }, Synonym_Request_Count{ synonym_request_count }, Current_Date{ std::move(current_date) } { } // --------------------------------------------------------------------------------------------------------------------- @@ -49,7 +49,7 @@ const std::string& SMetrics::Get_Current_Date() const // --------------------------------------------------------------------------------------------------------------------- std::int64_t SMetrics::Get_Total_Number_Of_Requests() const { - return Start_Request_Count + Profile_Request_Count + Pr_Game_Request_Count + Math_Game_Request_Count + Help_Request_Count + About_Project_Request_Count + Definition_Request_Count; + return Start_Request_Count + Profile_Request_Count + Pr_Game_Request_Count + Math_Game_Request_Count + Help_Request_Count + About_Project_Request_Count + Definition_Request_Count + Antonym_Request_Count + Synonym_Request_Count; } // --------------------------------------------------------------------------------------------------------------------- @@ -62,5 +62,7 @@ void SMetrics::Clear() Help_Request_Count = 0; About_Project_Request_Count = 0; Definition_Request_Count = 0; + Antonym_Request_Count = 0; + Synonym_Request_Count = 0; Current_Date = " "; } \ No newline at end of file diff --git a/source/business_logic/model/metrics/metrics_model.hpp b/source/business_logic/model/metrics/metrics_model.hpp index 1f88feb..6c41e2a 100644 --- a/source/business_logic/model/metrics/metrics_model.hpp +++ b/source/business_logic/model/metrics/metrics_model.hpp @@ -32,7 +32,7 @@ struct SMetrics { public: explicit SMetrics(); - [[maybe_unused]] explicit SMetrics(std::int64_t start_request_count, std::int64_t profile_request_count, std::int64_t pr_game_request_count, std::int64_t math_game_request_count, std::int64_t help_request_count, std::int64_t about_project_request_count, std::int64_t definition_request_count, std::string current_date); + [[maybe_unused]] explicit SMetrics(std::int64_t start_request_count, std::int64_t profile_request_count, std::int64_t pr_game_request_count, std::int64_t math_game_request_count, std::int64_t help_request_count, std::int64_t about_project_request_count, std::int64_t definition_request_count, std::int64_t antonym_request_count, std::int64_t synonym_request_count, std::string current_date); ~SMetrics() = default; @@ -42,6 +42,7 @@ struct SMetrics [[nodiscard]] std::int64_t Get_Total_Number_Of_Requests() const; void Clear(); + // antonym - synonym public: std::int64_t Start_Request_Count; std::int64_t Profile_Request_Count; @@ -50,6 +51,8 @@ struct SMetrics std::int64_t Help_Request_Count; std::int64_t About_Project_Request_Count; std::int64_t Definition_Request_Count; + std::int64_t Antonym_Request_Count; + std::int64_t Synonym_Request_Count; private: std::string Current_Date; From 527470bf102a4229d329113c42c40ed7d60a6898 Mon Sep 17 00:00:00 2001 From: b1tflyyyy Date: Mon, 6 May 2024 12:16:28 -0400 Subject: [PATCH 5/6] added new commands --- source/view/handlers/message_handler/message_handler.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/view/handlers/message_handler/message_handler.cpp b/source/view/handlers/message_handler/message_handler.cpp index c0fd689..51ed3bd 100644 --- a/source/view/handlers/message_handler/message_handler.cpp +++ b/source/view/handlers/message_handler/message_handler.cpp @@ -133,6 +133,9 @@ void AMessage_Handler::Bind_Commands() return; } + std::lock_guard locker(Mutex); + ++Metrics.Antonym_Request_Count; + Cut_User_Input(message->text, SMessage_Commands::Get_Antonym.size()); if (auto response{ English_Words_API_Controller.Get_Antonym(message->text) }; response != std::nullopt) { @@ -151,6 +154,9 @@ void AMessage_Handler::Bind_Commands() return; } + std::lock_guard locker(Mutex); + ++Metrics.Synonym_Request_Count; + Cut_User_Input(message->text, SMessage_Commands::Get_Synonym.size()); if (auto response{ English_Words_API_Controller.Get_Synonym(message->text) }; response != std::nullopt) { From 6cf18191b974ec96e5365ca8889bb75d60a990b5 Mon Sep 17 00:00:00 2001 From: b1tflyyyy Date: Mon, 6 May 2024 12:17:13 -0400 Subject: [PATCH 6/6] changed /answer to /ans --- source/view/texts/message_commands/message_commands.cpp | 2 +- source/view/texts/message_reply/message_reply.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/view/texts/message_commands/message_commands.cpp b/source/view/texts/message_commands/message_commands.cpp index 2e0f8b3..0cf650c 100644 --- a/source/view/texts/message_commands/message_commands.cpp +++ b/source/view/texts/message_commands/message_commands.cpp @@ -27,7 +27,7 @@ constinit std::string_view SMessage_Commands::Start{ "start" }; constinit std::string_view SMessage_Commands::Profile{ "profile" }; constinit std::string_view SMessage_Commands::Programmer_Game{ "pr_game" }; constinit std::string_view SMessage_Commands::Math_Game{ "math_game" }; -constinit std::string_view SMessage_Commands::Answer{ "answer" }; +constinit std::string_view SMessage_Commands::Answer{ "ans" }; constinit std::string_view SMessage_Commands::Help{ "help" }; constinit std::string_view SMessage_Commands::About_Project{ "about_project" }; constinit std::string_view SMessage_Commands::Definiton{ "def" }; diff --git a/source/view/texts/message_reply/message_reply.cpp b/source/view/texts/message_reply/message_reply.cpp index 2bb00de..b62cc92 100644 --- a/source/view/texts/message_reply/message_reply.cpp +++ b/source/view/texts/message_reply/message_reply.cpp @@ -38,13 +38,13 @@ std::string AMessage_Reply::Get_Profile_Msg(const AUser& user, std::int64_t scor // --------------------------------------------------------------------------------------------------------------------- std::string AMessage_Reply::Get_Programmer_Game_Msg(const programmer_game::SExpression& expression) { - return std::format("Головний Арбуз вигенерував для тебе задачку з бінарним кодом:\n\n1-число:\t{}\n2-число:\t{}\nОперація яку слід примінити: {}\n\nВідповідь напиши за допомогою /answer (тут пробіл) відповідь", expression.First_Operand, expression.Second_Operand, expression.Operation); + return std::format("Головний Арбуз вигенерував для тебе задачку з бінарним кодом:\n\n1-число:\t{}\n2-число:\t{}\nОперація яку слід примінити: {}\n\nВідповідь напиши за допомогою /ans (тут пробіл) відповідь", expression.First_Operand, expression.Second_Operand, expression.Operation); } // --------------------------------------------------------------------------------------------------------------------- std::string AMessage_Reply::Get_Math_Game_Msg(const math_game::SMath_Expression& expression) { - return std::format("Головний Арбуз вигенерував для тебе математичну задачку:\n{}\n\nВідповідь напиши за допомогою /answer (тут пробіл) відповідь", expression.Expression); + return std::format("Головний Арбуз вигенерував для тебе математичну задачку:\n{}\n\nВідповідь напиши за допомогою /ans (тут пробіл) відповідь", expression.Expression); } // --------------------------------------------------------------------------------------------------------------------- @@ -68,7 +68,7 @@ std::string AMessage_Reply::Get_Incorrect_Answer_Msg(std::int64_t score, std::st // --------------------------------------------------------------------------------------------------------------------- std::string AMessage_Reply::Get_Help_Msg() { - return std::format("Привіт Арбуз, це блок з поясненням деяких ігрових механік {}\n\n1) Як відповідати на задачі ?\nВсе дуже просто пишеш команду /answer і через пробіл відповідь, наприклад: /answer 25\n\n2) Як вирішити гру pr_game, погугли про оператори &(AND) |(OR)\n\nЯкщо в тебе виникли проблеми, пиши власнику бота на пошту theb1tfoundation.gh@gmail.com", DETAIL); + return std::format("Привіт Арбуз, це блок з поясненням деяких ігрових механік {}\n\n1) Як відповідати на задачі ?\nВсе дуже просто пишеш команду /ans і через пробіл відповідь, наприклад: /ans 25\n\n2) Як вирішити гру pr_game, погугли про оператори &(AND) |(OR)\n\nЯкщо в тебе виникли проблеми, пиши власнику бота на пошту theb1tfoundation.gh@gmail.com", DETAIL); } // --------------------------------------------------------------------------------------------------------------------- @@ -98,7 +98,7 @@ std::string AMessage_Reply::Get_Metrics_Range_Msg(const std::pair