shurillu / CTBot

A simple (and easy to use) Arduino Telegram BOT Library for ESP8266/ESP32
MIT License
150 stars 34 forks source link

Help cant connect to telegram #48

Closed eyip480 closed 4 years ago

eyip480 commented 4 years ago

Hello guys, i need help in my project yeaaa, i want to make LED control using nodemcu and telegram after iam upload, its no error but NodeMCU cant connect to telegram. i dunno why? when i check test connection, its always error

my code `#include "CTBot.h" CTBot faiq; int led = 16; void setup() { // put your setup code here, to run once: Serial.begin(115200); pinMode(led, OUTPUT); digitalWrite(led, 0); faiq.wifiConnect("eyip", "passw0rd"); faiq.setTelegramToken("xxx"); if (faiq.testConnection()) { Serial.println("connected"); } else { Serial.println("error"); } }

void loop() { // put your main code here, to run repeatedly: if (faiq.testConnection() == 0) { Serial.println("error"); } if (faiq.testConnection() == 1) { Serial.println("berhasil"); while (1) { TBMessage message; if (faiq.getNewMessage(message)) { Serial.print("Incoming Message : "); Serial.println(message.text); if (message.text.equalsIgnoreCase("ON")) { digitalWrite(led, 1); faiq.sendMessage(message.sender.id, "LED ON"); } else if (message.text.equalsIgnoreCase("OFF")) { digitalWrite(led, 0); faiq.sendMessage(message.sender.id, "LED OFF"); } else { String answer; answer = "wrong"; faiq.sendMessage(message.sender.id, answer); } } } } delay(200); }`

maybe anyone can help me? or maybe any other program that i can try. i just want to connect my nodemcu to telegram, but now iam frustated. i buy 2 nodeMCU, first amica and then lolin, and both i cant connect to telegram

iam using board esp8266 version 2.5.0 and arduinojson 5.13.5

thanks before

shurillu commented 4 years ago

Hello eyip480, first of all, hide your telegram Token (delete it from your post): it is like your email credentials! With that everyone can access to your bot and use it as they want ;-) Speaking about your question: Telegram has changed his certificate thus the fingerprint in the library is not valid anymore. I already published a new version (1.4.1) but I don't know if it is already available as library update inside the Arduino IDE. If not, download it from here (GitHub) and overwrite the old library (1.4.0).

Let me know if it solve your issue ;-) Cheers,

Stefano

eyip480 commented 4 years ago

my library its already 1.4.1 but i dunno its always error when connecting to telegram, but that nodeMCU can connect to wifi. i also trying use example sketch "echoBot" and still error, testConnection NOK

its my setting Screenshot_932

anything wrongs?

eyip480 commented 4 years ago

thanks bro, i think my token is wrong. i typed manually, and last i try to direct copy from telegram, so i not manually typing. and its work. thanksss sorrryy