diff options
Diffstat (limited to 'src/tgbot/Bot.h')
-rw-r--r-- | src/tgbot/Bot.h | 43 |
1 files changed, 9 insertions, 34 deletions
diff --git a/src/tgbot/Bot.h b/src/tgbot/Bot.h index 488ceb1..eeef27a 100644 --- a/src/tgbot/Bot.h +++ b/src/tgbot/Bot.h @@ -26,25 +26,15 @@ #include <string> #include "tgbot/Api.h" -#include "tgbot/EventManager.h" -#include "tgbot/Http.h" -#include "tgbot/Parser.h" +#include "tgbot/EventBroadcaster.h" +#include "tgbot/EventHandler.h" namespace TgBot { class Bot { public: - explicit Bot(const std::string& token); - - void startLongPoll(); - - inline void startServer(unsigned short port) { - _http.startServer(port, _webhooksServerHandler); - } - - inline void startServer(const std::string& unixSocketPath) { - _http.startServer(unixSocketPath, _webhooksServerHandler); + explicit Bot(const std::string& token) : _token(token), _api(token), _eventHandler(&_eventBroadcaster) { } inline const std::string& getToken() const { @@ -55,34 +45,19 @@ public: return _api; } - inline const EventManager& getEvents() const { - return _events; - } - - inline EventManager& getEvents() { - return _events; - } - - inline const Http& getHttp() const { - return _http; - } - - inline Http& getHttp() { - return _http; + inline EventBroadcaster& getEvents() { + return _eventBroadcaster; } - inline const Parser& getParser() const { - return _parser; + inline const EventHandler& getEventHandler() const { + return _eventHandler; } private: const std::string _token; const Api _api; - EventManager _events; - Http _http; - const Parser _parser; - const Http::ServerHandler _webhooksServerHandler; - int32_t _lastUpdateId = 0; + EventBroadcaster _eventBroadcaster; + const EventHandler _eventHandler; }; } |