@@ -611,14 +611,7 @@ bool UniversalTelegramBot::sendMessageWithReplyKeyboard(
611
611
612
612
JsonObject replyMarkup = payload.createNestedObject (" reply_markup" );
613
613
614
- // Reply keyboard is an array of arrays.
615
- // Outer array represents rows
616
- // Inner arrays represents columns
617
- // This example "ledon" and "ledoff" are two buttons on the top row
618
- // and "status is a single button on the next row"
619
- DynamicJsonDocument keyboardBuffer (maxMessageLength); // creating a buffer enough to keep keyboard string
620
- deserializeJson (keyboardBuffer, keyboard);
621
- replyMarkup[" keyboard" ] = keyboardBuffer.as <JsonArray>();
614
+ replyMarkup[" keyboard" ] = serialized (keyboard);
622
615
623
616
// Telegram defaults these values to false, so to decrease the size of the
624
617
// payload we will only send them if needed
@@ -647,9 +640,7 @@ bool UniversalTelegramBot::sendMessageWithInlineKeyboard(String chat_id,
647
640
payload[" parse_mode" ] = parse_mode;
648
641
649
642
JsonObject replyMarkup = payload.createNestedObject (" reply_markup" );
650
- DynamicJsonDocument keyboardBuffer (maxMessageLength); // assuming keyboard buffer will alwas be limited to 1024 bytes
651
- deserializeJson (keyboardBuffer, keyboard);
652
- replyMarkup[" inline_keyboard" ] = keyboardBuffer.as <JsonArray>();
643
+ replyMarkup[" inline_keyboard" ] = serialized (keyboard);
653
644
return sendPostMessage (payload.as <JsonObject>());
654
645
}
655
646
0 commit comments