32 lines
791 B
C++
32 lines
791 B
C++
#pragma once
|
|
|
|
#include <map>
|
|
|
|
#include "config.h"
|
|
#include "TAPIManager.h"
|
|
#include "TAPIMarkup.h"
|
|
|
|
#include "game.h"
|
|
|
|
class Bot {
|
|
public:
|
|
Bot(TelegramAPI::Manager* tapi, Conf& conf);
|
|
~Bot();
|
|
|
|
bool handleStart(TelegramAPI::Manager* api, const TelegramAPI::Message& msg);
|
|
|
|
bool handleMessage(TelegramAPI::Manager* api, TelegramAPI::Message& msg);
|
|
bool handleCallback(TelegramAPI::Manager* api, TelegramAPI::CallbackQuery& clbq);
|
|
|
|
void stop();
|
|
|
|
private:
|
|
TelegramAPI::Manager* tapi;
|
|
Conf& conf;
|
|
|
|
void updateGame(int64_t chatid, uint64_t msgid, const Game& g);
|
|
TelegramAPI::InlineKeyboard gameToKeyboard(const Game&) const;
|
|
std::string gameToMessage(const Game&, std::vector<TelegramAPI::MessageEntity>& entites) const;
|
|
|
|
Game* messageToGame(const TelegramAPI::Message& msg) const;
|
|
}; |