AsyncTelegram2
Loading...
Searching...
No Matches
ReplyKeyboard.h
Go to the documentation of this file.
1
2#ifndef REPLY_KEYBOARD
3#define REPLY_KEYBOARD
4
5#define ARDUINOJSON_USE_LONG_LONG 1
6#define ARDUINOJSON_DECODE_UNICODE 1
7#include <ArduinoJson.h>
8#include "DataStructures.h"
9#include "serial_log.h"
10
15};
16
17
19{
20private:
21 String m_json;
22 size_t m_jsonSize = BUFFER_MEDIUM;
23
24public:
27
28 // add a new empty row of buttons
29 // return:
30 // true if no error occurred
31 bool addRow(void);
32
33 // add a button in the current row
34 // params:
35 // text : the text displayed as button label
36 // buttonType: the type of the button (simple text, contact request, location request)
37 // return:
38 // true if no error occurred
39 bool addButton(const char* text, ReplyKeyboardButtonType buttonType = KeyboardButtonSimple);
40
41 // enable reply keyboard autoresizing (default: the same size of the standard keyboard)
42 void enableResize(void);
43
44 // hide the reply keyboard as soon as it's been used
45 void enableOneTime(void);
46
47 // Use this parameter if you want to show the keyboard for specific users only.
48 // Targets: 1) users that are @mentioned in the text of the Message object;
49 // 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message
50 void enableSelective(void);
51
52 // generate a string that contains the inline keyboard formatted in a JSON structure.
53 // returns:
54 // the JSON of the inline keyboard
55 String getJSON(void) const;
56 String getJSONPretty() const;
57
58
59 inline void clear() {
60 m_json = "{\"keyboard\":[[]]}\"";
61 }
62};
63
64#endif
#define BUFFER_MEDIUM
Definition: DataStructures.h:6
ReplyKeyboardButtonType
Definition: ReplyKeyboard.h:11
@ KeyboardButtonLocation
Definition: ReplyKeyboard.h:14
@ KeyboardButtonContact
Definition: ReplyKeyboard.h:13
@ KeyboardButtonSimple
Definition: ReplyKeyboard.h:12
String getJSON(void) const
void enableOneTime(void)
void enableSelective(void)
void enableResize(void)
String getJSONPretty() const
bool addRow(void)
bool addButton(const char *text, ReplyKeyboardButtonType buttonType=KeyboardButtonSimple)