tgbot-cpp
Loading...
Searching...
No Matches
Bot.h
Go to the documentation of this file.
1#ifndef TGBOT_CPP_BOT_H
2#define TGBOT_CPP_BOT_H
3
4#include "tgbot/Api.h"
6
7#include <memory>
8#include <string>
9#include <utility>
10
11namespace TgBot {
12
13class EventBroadcaster;
14class HttpClient;
15
21class TGBOT_API Bot {
22
23public:
24 explicit Bot(std::string token, const HttpClient &httpClient = _getDefaultHttpClient(), const std::string& url="https://api.telegram.org");
25
29 inline const std::string& getToken() const {
30 return _token;
31 }
32
36 inline const Api& getApi() const {
37 return _api;
38 }
39
44 return *_eventBroadcaster;
45 }
46
50 inline const EventHandler& getEventHandler() const {
51 return _eventHandler;
52 }
53
54private:
55 static HttpClient &_getDefaultHttpClient();
56
57 const std::string _token;
58 const Api _api;
59 std::unique_ptr<EventBroadcaster> _eventBroadcaster;
60 const EventHandler _eventHandler;
61};
62
63}
64
65#endif //TGBOT_CPP_BOT_H
This class executes telegram api methods. Telegram docs: https://core.telegram.org/bots/api#available...
Definition Api.h:48
This object holds other objects specific for this bot instance.
Definition Bot.h:21
const Api & getApi() const
Definition Bot.h:36
EventBroadcaster & getEvents()
Definition Bot.h:43
const std::string & getToken() const
Definition Bot.h:29
Bot(std::string token, const HttpClient &httpClient=_getDefaultHttpClient(), const std::string &url="https://api.telegram.org")
const EventHandler & getEventHandler() const
Definition Bot.h:50
This class holds all event listeners.
This class makes http requests.
Definition HttpClient.h:18
Definition Api.h:39