Universal-Arduino-Telegram-Bot
Universal-Arduino-Telegram-Bot copied to clipboard
Remove keyboard feature added, here is the code i used.
In the .ino file, this is de command to trigger the remove keyboard function
bot.sendMessageWithRemoveKeyboard(chat_id, "Your text", true);
In the UniversalTelegramBot.h file i added this
bool sendMessageWithRemoveKeyboard(const String& chat_id, const String& text, bool remove_keyboard = false);
In the UniversalTelegramBot.cpp file i added this
bool UniversalTelegramBot::sendMessageWithRemoveKeyboard(const String& chat_id,
const String& text,
bool remove_keyboard) {
DynamicJsonDocument payload(maxMessageLength);
payload["chat_id"] = chat_id;
payload["text"] = text;
JsonObject replyMarkup = payload.createNestedObject("reply_markup");
if (remove_keyboard)
replyMarkup["remove_keyboard"] = remove_keyboard;
return sendPostMessage(payload.as<JsonObject>());
}
There is an option "selective" for the remove keyboard. It didn't add that function, it is optional. But i think it is not a problem for you to add that to the code.
Anyone interested in turning this into a PR? Would either need a new example or the existing keyboard example to be updated