witnessmenow / Universal-Arduino-Telegram-Bot

Use Telegram on your Arduino (ESP8266 or Wifi-101 boards)
MIT License
1.13k stars 311 forks source link

Autentification for Telegram Bot #103

Open burdeyniyua opened 5 years ago

burdeyniyua commented 5 years ago

Hello! I want to do something like smart home with telegram-bot and esp8266. I want to do autentification for me and my wife only. I looked for https://github.com/witnessmenow/Immersion-Bot/blob/master/Immersion-Bot.ino ? but I can't compile it - 'numberAuthUsers' was not declared in this scope. Can any body help? How I can flash led https://github.com/witnessmenow/Universal-Arduino-Telegram-Bot/blob/master/examples/ESP8266/FlashLED/FlashLED.ino with autentification by userID?

witnessmenow commented 5 years ago

Hi, the immersion bot was built using an old version of the library and I guess doesn't work as it is anymore.

To add what your talking about just check that the chat id of the recieved message matches your or your wife's in the recieved message method, and don't respond to the message if it doesn't match

bot.messages[i].chat_id

On Wed, 9 Jan 2019, 07:56 burdeyniyua <notifications@github.com wrote:

Hello! I want to do something like smart home with telegram-bot and esp8266. I want to do autentification for me and my wife only. I looked for https://github.com/witnessmenow/Immersion-Bot/blob/master/Immersion-Bot.ino http://url ? but I can't compile it - 'numberAuthUsers' was not declared in this scope. Can any body help? How I can flash led https://github.com/witnessmenow/Universal-Arduino-Telegram-Bot/blob/master/examples/ESP8266/FlashLED/FlashLED.ino http://url with autentification by userID?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/witnessmenow/Universal-Arduino-Telegram-Bot/issues/103, or mute the thread https://github.com/notifications/unsubscribe-auth/ABfXwtNcyxNtGG5pTs8SiFfBFv5tEXzqks5vBaCdgaJpZM4Z28y9 .

burdeyniyua commented 5 years ago

It must be something like this?

if (bot.messages[i].chat_id == "myID" || bot.messages[i].chat_id == "wifeID") {
//......program code.... 
}
else {
bot.sendMessage(chat_id, "You are not Administrator of this bot", "");
}
burdeyniyua commented 5 years ago

You can close issue. Cod works.