We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7f5a9ee commit a659ac3Copy full SHA for a659ac3
examples/ESP8266/SendPhoto/PhotoFromFileID/PhotoFromFileID.ino
@@ -43,10 +43,14 @@ void handleNewMessages(int numNewMessages) {
43
44
// There are 3 image sizes after Telegram has process photo
45
// You may choose what you want, in example was choosed bigger size
46
- String file_id = images["result"]["photo"][2]["file_id"];
+ int photosArrayLength = images["result"]["photo"].size();
47
48
- if (file_id) {
49
- bot.sendPhoto(chat_id, file_id, "This photo was sent using File ID");
+ if (photosArrayLength > 0) {
+ String file_id = images["result"]["photo"][photosArrayLength-1]["file_id"];
50
+
51
+ if (file_id) {
52
+ bot.sendPhoto(chat_id, file_id, "This photo was sent using File ID");
53
+ }
54
}
55
56
0 commit comments