#include <CTBot.h>
#define LED 2
CTBot bot_didactico;
String TOKEN = "6128628487:AAEtQd6GsjHaOHx1XWnKaB8tYpSXFs2shdc";
String SSID = "Wokwi-GUEST";
String PSWD = "";
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
bot_didactico.wifiConnect(SSID, PSWD);
bot_didactico.setTelegramToken(TOKEN);
if(bot_didactico.testConnection()){
Serial.println("Conectado exitosamente al Telegram");
} else{
Serial.println("No hay conexion con Telegram");
}
pinMode(LED, OUTPUT);
digitalWrite(LED, LOW);
}
void loop() {
TBMessage mensaje;
if(bot_didactico.getNewMessage(mensaje)){
Serial.println("hay un nuevo mensjase en el chat!!");
//Serial.print("enviado por:");
//Serial.println(mensaje.sender.id);
Serial.print("Mensaje leido:");
Serial.println(mensaje.text);
bot_didactico.sendMessage(mensaje.sender.id,"hola,soy scp32");
}
}