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
|
|
@ -12,10 +12,11 @@ void AnimeBot::setupHandlers() {
|
|||
sendMainMenu(message->chat->id);
|
||||
});
|
||||
|
||||
auto [text, kb] = BotHandlers::MyTitles(321);
|
||||
auto [text, kb] = BotHandlers::returnMyTitles(321);
|
||||
|
||||
bot.getEvents().onCallbackQuery([text, kb, this](TgBot::CallbackQuery::Ptr query) {
|
||||
bot.getApi().editMessageText(
|
||||
auto cp_api = bot.getApi();
|
||||
bot.getEvents().onCallbackQuery([text, kb, cp_api](TgBot::CallbackQuery::Ptr query) {
|
||||
cp_api.editMessageText(
|
||||
text,
|
||||
query->message->chat->id,
|
||||
query->message->messageId,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,18 @@
|
|||
#include "handlers.hpp"
|
||||
#include "KeyboardFactory.hpp"
|
||||
#include "structs.hpp"
|
||||
#include "constants.hpp"
|
||||
|
||||
void BotHandlers::handleCallback(const TgBot::CallbackQuery::Ptr query) {
|
||||
std::string data = query -> data;
|
||||
|
||||
if (data.starts_with(BotConstants::Callback::NAVIGATION)) {
|
||||
handleNavigation(query);
|
||||
}
|
||||
}
|
||||
|
||||
/// В угоду потокобезопасности создаем новый экземпляр TgBot::Api
|
||||
HandlerResult BotHandlers::MyTitles(int64_t userId) {
|
||||
HandlerResult BotHandlers::returnMyTitles(int64_t userId) {
|
||||
// Здесь должен происходить запрос на сервер
|
||||
std::vector<Title> titles = {{123, "Школа мертвяков", "", 1}, {321, "KissXsis", "", 2}};
|
||||
|
||||
|
|
@ -13,3 +22,7 @@ HandlerResult BotHandlers::MyTitles(int64_t userId) {
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
void BotHandlers::handleNavigation(const TgBot::CallbackQuery::Ptr query) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue