diff --git a/src/UniversalTelegramBot.cpp b/src/UniversalTelegramBot.cpp index fbb1ac7..d7c6b5c 100644 --- a/src/UniversalTelegramBot.cpp +++ b/src/UniversalTelegramBot.cpp @@ -444,6 +444,7 @@ bool UniversalTelegramBot::processResult(JsonObject result, int messageIndex) { messages[messageIndex].text = F(""); messages[messageIndex].from_id = F(""); messages[messageIndex].from_name = F(""); + messages[messageIndex].username= F(""); messages[messageIndex].longitude = 0; messages[messageIndex].latitude = 0; messages[messageIndex].reply_to_message_id = 0; @@ -455,6 +456,7 @@ bool UniversalTelegramBot::processResult(JsonObject result, int messageIndex) { messages[messageIndex].type = F("message"); messages[messageIndex].from_id = message["from"]["id"].as(); messages[messageIndex].from_name = message["from"]["first_name"].as(); + messages[messageIndex].username= message["from"]["username"].as(); messages[messageIndex].date = message["date"].as(); messages[messageIndex].chat_id = message["chat"]["id"].as(); messages[messageIndex].chat_title = message["chat"]["title"].as(); @@ -495,6 +497,7 @@ bool UniversalTelegramBot::processResult(JsonObject result, int messageIndex) { messages[messageIndex].type = F("callback_query"); messages[messageIndex].from_id = message["from"]["id"].as(); messages[messageIndex].from_name = message["from"]["first_name"].as(); + messages[messageIndex].username= message["from"]["username"].as(); messages[messageIndex].text = message["data"].as(); messages[messageIndex].date = message["date"].as(); messages[messageIndex].chat_id = message["message"]["chat"]["id"].as(); @@ -508,6 +511,7 @@ bool UniversalTelegramBot::processResult(JsonObject result, int messageIndex) { messages[messageIndex].type = F("edited_message"); messages[messageIndex].from_id = message["from"]["id"].as(); messages[messageIndex].from_name = message["from"]["first_name"].as(); + messages[messageIndex].username= message["from"]["username"].as(); messages[messageIndex].date = message["date"].as(); messages[messageIndex].chat_id = message["chat"]["id"].as(); messages[messageIndex].chat_title = message["chat"]["title"].as(); diff --git a/src/UniversalTelegramBot.h b/src/UniversalTelegramBot.h index 5fc97ee..55e13a9 100644 --- a/src/UniversalTelegramBot.h +++ b/src/UniversalTelegramBot.h @@ -48,6 +48,7 @@ struct telegramMessage { String chat_title; String from_id; String from_name; + String username; String date; String type; String file_caption;