#include "CTBot.h"
#include <WiFi.h>
#include <WiFiClient.h>
CTBot myBot;
String ssid = "Wokwi-GUEST";
String pass = "";
String token = "6870174856:AAGc7nIIsPIzq00bguep9MEXaoH4tj9McIQ";
const int id = 5065918185;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Memulai telegram bot");
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:
TBMessage msg;
if (myBot.getNewMessage(msg)) {
Serial.println("Pesan masuk: " + msg.text);
String pesan = msg.text;
if (pesan == "Hallo") {
myBot.sendMessage(id, "Hallo Juga....");
} else if (pesan == "Apa kabar?") {
myBot.sendMessage(id, "kabar Baik....");
}
}
}