tgbot-cpp
Loading...
Searching...
No Matches
Bot.h
Go to the documentation of this file.
1#pragma once
2
3#include "tgbot/Api.h"
5#include "tgbot/export.h"
6
7#include <memory>
8#include <string>
9
10namespace TgBot {
11
13class HttpClient;
14
21public:
22 explicit Bot(std::string token, const HttpClient& httpClient = _getDefaultHttpClient(),
23 const std::string& url = "https://api.telegram.org");
24
28 const std::string& getToken() const {
29 return _token;
30 }
31
35 const Api& getApi() const {
36 return _api;
37 }
38
43 return *_eventBroadcaster;
44 }
45
50 return _eventHandler;
51 }
52
53private:
54 static HttpClient& _getDefaultHttpClient();
55
56 const std::string _token;
57 const Api _api;
58 std::unique_ptr<EventBroadcaster> _eventBroadcaster;
59 const EventHandler _eventHandler;
60};
61
62} // namespace TgBot
Executes methods from the Telegram Bot API.
Definition Api.h:30
const Api & getApi() const
Definition Bot.h:35
EventBroadcaster & getEvents()
Definition Bot.h:42
const std::string & getToken() const
Definition Bot.h:28
Bot(std::string token, const HttpClient &httpClient=_getDefaultHttpClient(), const std::string &url="https://api.telegram.org")
const EventHandler & getEventHandler() const
Definition Bot.h:49
This class holds all event listeners.
This class makes http requests.
Definition HttpClient.h:18
#define TGBOT_API
Definition export.h:5
Definition Api.h:17