feat(tgbot-back): start to develop back
Implemented fetchUserTitlesAsync func and embedded it in the code of the front in the trial mode. It needs to be restructured
This commit is contained in:
parent
4ca8b19adb
commit
847aec7bdd
9 changed files with 190 additions and 13 deletions
|
|
@ -3,6 +3,7 @@
|
|||
#include <string>
|
||||
#include <structs.hpp>
|
||||
#include <unordered_map>
|
||||
#include "BotToServer.hpp"
|
||||
|
||||
/// @brief Структура возвращаемого значения класса BotHandlers для изменения текущего сообщения
|
||||
struct HandlerResult {
|
||||
|
|
@ -58,6 +59,7 @@ public:
|
|||
private:
|
||||
TgBot::Api botApi;
|
||||
std::unordered_map<int64_t, UserContext> userContexts;
|
||||
BotToServer server_;
|
||||
|
||||
void handleNavigation(TgBot::CallbackQuery::Ptr query, UserContext& ctx);
|
||||
|
||||
|
|
@ -104,7 +106,7 @@ private:
|
|||
/// @brief Отрисовка текущего экрана (соотв. контексту)
|
||||
/// @param ctx - текущий контекст
|
||||
/// @return HandlerResult для нового состояния сообщения
|
||||
HandlerResult renderCurrent(const UserContext& ctx);
|
||||
HandlerResult renderCurrent(TgBot::CallbackQuery::Ptr query, const UserContext& ctx);
|
||||
|
||||
/// @brief Логика переходов между контекстами (навигация на следующий шаг)
|
||||
/// @param query - запрос
|
||||
|
|
@ -120,4 +122,7 @@ private:
|
|||
/// @brief Посылает интерфейс обработки ошибки на callback запрос
|
||||
/// @param query запрос
|
||||
void sendError(TgBot::CallbackQuery::Ptr query, const std::string& errText);
|
||||
|
||||
// Форматирование для отображения в сообщении
|
||||
std::string formatTitlesList(const std::vector<BotStructs::Title>& titles);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue