AsyncTelegram2
Loading...
Searching...
No Matches
src
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
11
enum
ReplyKeyboardButtonType
{
12
KeyboardButtonSimple
= 1,
13
KeyboardButtonContact
= 2,
14
KeyboardButtonLocation
= 3
15
};
16
17
18
class
ReplyKeyboard
19
{
20
private
:
21
String m_json;
22
size_t
m_jsonSize =
BUFFER_MEDIUM
;
23
24
public
:
25
ReplyKeyboard
();
26
~ReplyKeyboard
();
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
DataStructures.h
BUFFER_MEDIUM
#define BUFFER_MEDIUM
Definition:
DataStructures.h:6
ReplyKeyboardButtonType
ReplyKeyboardButtonType
Definition:
ReplyKeyboard.h:11
KeyboardButtonLocation
@ KeyboardButtonLocation
Definition:
ReplyKeyboard.h:14
KeyboardButtonContact
@ KeyboardButtonContact
Definition:
ReplyKeyboard.h:13
KeyboardButtonSimple
@ KeyboardButtonSimple
Definition:
ReplyKeyboard.h:12
ReplyKeyboard
Definition:
ReplyKeyboard.h:19
ReplyKeyboard::getJSON
String getJSON(void) const
Definition:
ReplyKeyboard.cpp:221
ReplyKeyboard::enableOneTime
void enableOneTime(void)
Definition:
ReplyKeyboard.cpp:163
ReplyKeyboard::enableSelective
void enableSelective(void)
Definition:
ReplyKeyboard.cpp:192
ReplyKeyboard::~ReplyKeyboard
~ReplyKeyboard()
Definition:
ReplyKeyboard.cpp:9
ReplyKeyboard::clear
void clear()
Definition:
ReplyKeyboard.h:59
ReplyKeyboard::enableResize
void enableResize(void)
Definition:
ReplyKeyboard.cpp:132
ReplyKeyboard::ReplyKeyboard
ReplyKeyboard()
Definition:
ReplyKeyboard.cpp:3
ReplyKeyboard::getJSONPretty
String getJSONPretty() const
Definition:
ReplyKeyboard.cpp:226
ReplyKeyboard::addRow
bool addRow(void)
Definition:
ReplyKeyboard.cpp:11
ReplyKeyboard::addButton
bool addButton(const char *text, ReplyKeyboardButtonType buttonType=KeyboardButtonSimple)
Definition:
ReplyKeyboard.cpp:35
serial_log.h
Generated by
1.9.6