|
| TelegramBotClient (String token, Client &sslPollClient, Client &sslPostClient, TBC_CALLBACK_RECEIVE_SIGNATURE, TBC_CALLBACK_ERROR_SIGNATURE) |
| Constructor. More...
|
|
| TelegramBotClient (String token, Client &sslPollClient, Client &sslPostClient) |
| Constructor. More...
|
|
| TelegramBotClient (String token, Client &sslPollClient) |
| Constructor. More...
|
|
| ~TelegramBotClient () |
| Destructor. More...
|
|
void | begin (TBC_CALLBACK_RECEIVE_SIGNATURE, TBC_CALLBACK_ERROR_SIGNATURE) |
| Alias for setCallbacks following Arduino convention. More...
|
|
void | setCallbacks (TBC_CALLBACK_RECEIVE_SIGNATURE, TBC_CALLBACK_ERROR_SIGNATURE) |
| Sets callbacks. More...
|
|
bool | loop () |
| Handles client background tasks. More...
|
|
void | postMessage (long chatId, String text, TBCKeyBoard &keyBoard) |
| Post a message. More...
|
|
void | postMessage (long chatId, String text) |
| Post a message. More...
|
|
void | pollSuccess (JwcProcessError err, JsonObject &json) |
| Callback called by JSONWebClient. More...
|
|
void | pollError (JwcProcessError err, Client *client) |
| Callback called by JSONWebClient. More...
|
|
void | postSuccess (JwcProcessError err, JsonObject &json) |
| Callback called by JSONWebClient. More...
|
|
void | postError (JwcProcessError err, Client *client) |
| Callback called by JSONWebClient. More...
|
|
|
static void | callbackPollSuccess (void *obj, JwcProcessError err, JsonObject &json) |
|
static void | callbackPollError (void *obj, JwcProcessError err, Client *client) |
|
static void | callbackPostSuccess (void *obj, JwcProcessError err, JsonObject &json) |
|
static void | callbackPostError (void *obj, JwcProcessError err, Client *client) |
|
◆ TelegramBotClient() [1/3]
Constructor.
Constructor, initializing all members including callbacks using different clients for posting and polling
- Parameters
-
token | secure token for your bot provided by BotFather. |
sslPollClient | SSL client used for polling messages from remote server |
sslPostClient | SSL client used for posting messages to remote server |
TBC_CALLBACK_RECEIVE_SIGNATURE | Callback called on receiving a message |
TBC_CALLBACK_ERROR_SIGNATURE | Callback called on error while receiving |
◆ TelegramBotClient() [2/3]
TelegramBotClient::TelegramBotClient |
( |
String |
token, |
|
|
Client & |
sslPollClient, |
|
|
Client & |
sslPostClient |
|
) |
| |
|
inline |
Constructor.
Constructor, initializing only members no callbacks using different clients for posting and polling
- Parameters
-
token | secure token for your bot provided by BotFather. |
sslPollClient | SSL client used for polling messages from remote server |
sslPostClient | SSL client used for posting messages to remote server |
◆ TelegramBotClient() [3/3]
TelegramBotClient::TelegramBotClient |
( |
String |
token, |
|
|
Client & |
sslPollClient |
|
) |
| |
|
inline |
Constructor.
Constructor, initializing only members no callbacks using the same client for posting and polling
- Parameters
-
token | secure token for your bot provided by BotFather. |
sslPollClient | SSL client used for polling messages from remote server |
sslPostClient | SSL client used for posting messages to remote server |
◆ ~TelegramBotClient()
TelegramBotClient::~TelegramBotClient |
( |
| ) |
|
◆ begin()
Alias for setCallbacks following Arduino convention.
- Parameters
-
[in] | TBC_CALLBACK_RECEIVE_SIGNATURE | Callback called on receiving a message |
[in] | TBC_CALLBACK_ERROR_SIGNATURE | Callback called on error while receiving |
- Returns
- Nothing
Alias for setCallbacks following Arduino convention sets callbacks
◆ loop()
bool TelegramBotClient::loop |
( |
| ) |
|
Handles client background tasks.
- Returns
- Return true is an action was needed and performed
Handles client background tasks, shall be calles in every main loop()
◆ pollError()
Callback called by JSONWebClient.
- Parameters
-
[in] | err | Error Code from JwcProcessError |
[in] | client | Client that causes the problem. |
- Returns
- Nothing
This is an internal method called by underlying JSONWebClient
- Note
- Do not call this method.
◆ pollSuccess()
void TelegramBotClient::pollSuccess |
( |
JwcProcessError |
err, |
|
|
JsonObject & |
json |
|
) |
| |
Callback called by JSONWebClient.
- Parameters
-
[in] | err | Error Code from JwcProcessError |
[in] | json | JsonObject generated by ArduinoJSON |
- Returns
- Nothing
This is an internal method called by underlying JSONWebClient
- Note
- Do not call this method.
◆ postError()
Callback called by JSONWebClient.
- Parameters
-
[in] | err | Error Code from JwcProcessError |
[in] | client | Client that causes the problem. |
- Returns
- Nothing
This is an internal method called by underlying JSONWebClient
- Note
- Do not call this method.
◆ postMessage() [1/2]
void TelegramBotClient::postMessage |
( |
long |
chatId, |
|
|
String |
text, |
|
|
TBCKeyBoard & |
keyBoard |
|
) |
| |
Post a message.
- Parameters
-
[in] | chatId | Id of the chat the message shall be sent to. |
[in] | text | Text of the message |
[in] | keyBoard | Optional. Keyboard to be send with this message. |
- Returns
- Nothing
Post a message to a given chat. (Only text messages and custom keyboards are supported, yet.)
◆ postMessage() [2/2]
void TelegramBotClient::postMessage |
( |
long |
chatId, |
|
|
String |
text |
|
) |
| |
|
inline |
Post a message.
- Parameters
-
[in] | chatId | Id of the chat the message shall be sent to. |
[in] | text | Text of the message |
- Returns
- Nothing
Post a message to a given chat. (Only text messages and custom keyboards are supported, yet.)
◆ postSuccess()
void TelegramBotClient::postSuccess |
( |
JwcProcessError |
err, |
|
|
JsonObject & |
json |
|
) |
| |
Callback called by JSONWebClient.
- Parameters
-
[in] | err | Error Code from JwcProcessError |
[in] | json | JsonObject generated by ArduinoJSON |
- Returns
- Nothing
This is an internal method called by underlying JSONWebClient
- Note
- Do not call this method.
◆ setCallbacks()
Sets callbacks.
- Parameters
-
[in] | TBC_CALLBACK_RECEIVE_SIGNATURE | Callback called on receiving a message |
[in] | TBC_CALLBACK_ERROR_SIGNATURE | Callback called on error while receiving |
- Returns
- Nothing
sets callbacks for receiving message and error handling
◆ startPolling()
void TelegramBotClient::startPolling |
( |
| ) |
|
|
private |
Starts polling.
- Returns
- Nothing
Starts the polling by open a http long call
◆ startPosting()
void TelegramBotClient::startPosting |
( |
String |
Message | ) |
|
|
private |
Starts posting a message.
- Parameters
-
[in] | The | Message to post as json string |
- Returns
- Nothing
Start the posting of a message by open a http post call
◆ LastUpdateId
long TelegramBotClient::LastUpdateId = 0 |
|
private |
Id of last update, used to generate a call returning only messages more recent than the last received.
◆ Parallel
bool TelegramBotClient::Parallel = false |
|
private |
Indicates if the client uses two underlying client objects allowing posting while keeping the poll call open in parallel.
◆ SslPollClient
Underlying client for polling.
◆ SslPostClient
Underlying client for posting. In case of parallel mode it uses the same Client object than SslPollClient
◆ TBC_CALLBACK_ERROR_SIGNATURE
TelegramBotClient::TBC_CALLBACK_ERROR_SIGNATURE |
|
private |
◆ TBC_CALLBACK_RECEIVE_SIGNATURE
TelegramBotClient::TBC_CALLBACK_RECEIVE_SIGNATURE |
|
private |
Callback called on receiving a message
◆ Token
String TelegramBotClient::Token |
|
private |
Secure Token provided by BotFather
The documentation for this class was generated from the following files: