#include "CTBot.h";
#include "ArduinoJson.h";
CTBot myBot;
String ssid = "Wokwi-GUEST";
String pass = "";
String token = "6550728122:AAH0Cd6YqwSBf-ZYWmfBvn0Vq4HK_O_JD3w";
const int id = 964724024;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
myBot.wifiConnect(ssid, pass);
myBot.setTelegramToken(token);
if(myBot.testConnection())
Serial.println("Koneksi berhasil");
else
Serial.println("Koneksi gagal");
}
void loop() {
// put your main code here, to run repeatedly:
// this speeds up the simulation
TBMessage msg;
if (myBot.getNewMessage(msg))
{
Serial.println("Pesan masuk:" + msg.text);
String pesan = msg.text;
if(pesan == "Hallo")
{
myBot.sendMessage(id, "Hallo juga");
}
}
}