getting ready to refactor the handlers structure
This commit is contained in:
parent
45a1df4cbb
commit
ea29fa79f0
4 changed files with 45 additions and 10 deletions
|
|
@ -7,13 +7,23 @@ namespace BotConstants {
|
|||
const std::string FIND_ANIME = "Найти аниме";
|
||||
const std::string MY_TITLES = "Мои тайтлы";
|
||||
const std::string PREV = "<<Назад";
|
||||
const std::string NEXT = "Следующий>>";
|
||||
const std::string NEXT = "Дальше>>";
|
||||
}
|
||||
namespace Callback {
|
||||
const std::string FIND_ANIME = "action:find_anime";
|
||||
const std::string MY_TITLES = "navigation:my_titles";
|
||||
const std::string LIST_PREV = "";
|
||||
const std::string LIST_NEXT = "";
|
||||
const std::string ACTION = "action:";
|
||||
const std::string FIND_ANIME = ACTION + "find_anime";
|
||||
const std::string ADD_REVIEW = ACTION + "add_review";
|
||||
const std::string ADD_STATUS = ACTION + "add_status";
|
||||
const std::string STATUS = "status:";
|
||||
const std::string WATCHING = STATUS + "watching";
|
||||
const std::string SEEN = STATUS + "seen";
|
||||
const std::string WANT = STATUS + "want";
|
||||
const std::string THROWN = STATUS + "thrown";
|
||||
const std::string NAVIGATION = "navigation:";
|
||||
const std::string MY_TITLES = NAVIGATION + "my_titles";
|
||||
const std::string LIST_PREV = NAVIGATION + "prev";
|
||||
const std::string LIST_NEXT = NAVIGATION + "next";
|
||||
const std::string CHOICE = "choice:";
|
||||
}
|
||||
namespace Text {
|
||||
const std::string MAIN_MENU = "Вас приветствует nyanimedb бот:)\nЧего будем делать?";
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include <string>
|
||||
#include <structs.hpp>
|
||||
|
||||
/// @brief Структура возвращаемого значения класса BotHandlers для изменения текущего сообщения
|
||||
struct HandlerResult {
|
||||
std::string message;
|
||||
TgBot::InlineKeyboardMarkup::Ptr keyboard;
|
||||
|
|
@ -9,5 +10,15 @@ struct HandlerResult {
|
|||
|
||||
class BotHandlers {
|
||||
public:
|
||||
static HandlerResult MyTitles(int64_t userId);
|
||||
void handleCallback(const TgBot::CallbackQuery::Ptr query);
|
||||
|
||||
private:
|
||||
TgBot::Api botApi;
|
||||
|
||||
void handleNavigation(const TgBot::CallbackQuery::Ptr query);
|
||||
|
||||
/// @brief Получить очередную страницу тайтлов из списка пользователя
|
||||
/// @param userId Идентификатор пользователя
|
||||
/// @return HandlerResult
|
||||
static HandlerResult returnMyTitles(int64_t userId);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue