void loop() { if (millis() > bot_last_check + bot_check_interval) { int numNewMessages = bot.getUpdates(bot.last_message_received + 1); while (numNewMessages) { for (int i = 0; i < numNewMessages; i++) { String chat_id = bot.messages[i].chat_id; String msg = bot.messages[i].text; Serial.println("Chat id:" + chat_id); Serial.println("Msg: " + msg); if (chat_id != "your_chat_id") { bot.sendMessage(chat_id, "You are not authorize to use this bot", ""); continue; } if (msg == "/capture") { sendImage(chat_id); } } numNewMessages = bot.getUpdates(bot.last_message_received + 1); } bot_last_check = millis(); } // delay(10); }