-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
store chat_id into EEPROM #247
Comments
Hello
There is an example for the esp32 that does at least most of what your
looking for, you will have to port it to the esp8266 if you want to run it
on a nodemcu though
https://github.com/witnessmenow/Universal-Arduino-Telegram-Bot/blob/master/examples/ESP32/SendMessageFromEvent/SendMessageFromEvent.ino
Chat IDs are technically strings from telegrams AP so I won't be changing
the type, you can attempt to convert it yourself if you need it as a long
int. Unless there is a reason to that you need to use eeprom I would just
keep the chat Id in your sketch. I would also consider using littleFS
rather than eeporom if you need to store things on an esp8266 that persists
after reboots.
Sending messages to everybody: not possible, not supported by the telegram
api. If you want to send to everyone connected to the bot you need to keep
track of all the users and send them the message 1 by 1
…On Tue 22 Jun 2021, 08:55 konig87nikkinakki, ***@***.***> wrote:
Good morning,
thank you for your library and sorry i'm a hobbist and then some Examples
are quite complicated for me. here's my issue:
1. i see in examples that BOT answers to the Sender using the chat_id
, otherwise he cannot answer
2. i d like to NodeMCU sends me text even if i didn't write him,
something when a door is opened.
3. so i obtained my ID of my telegram account, that is 7615439xx.
QUESTIONS:
4. can i use my chat_id into the script and send directly messages to
my smartphone?
5. if i didnt know my ID, i can have it from your Library because
there is
"String chat_id = bot.messages[i].chat_id;"
so i can read it first time i write to the bot, the NodeMCU can store
my id first time in EEPROM.
BUT chat_id you defined as STRING, i need it to be a Long Int, so what
can i do to convert to it, store in eeprom and then read FROM EEPROM
everytime it boot after power fail and convert again to string?
To avoid it, can your library send message to telegram and not to chat_id
so everyone that are using the BOT can receive mexage automatically?
something like "send to the chat" and not "send to the specified user"?
Thank you so much,
waiting for your help and sorry again for my inexperience, i'm a hobbist
but not a beginner
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#247>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAL5PQQ7QPIOPT6JEZILT5LTUA6XRANCNFSM47DD7QJA>
.
|
thank you for fast reply, really! EDIT: if i use this method i have to know chat_id before to compile program. if i could read from a received message, i could store in eeprom and in next reboot i can read from eeprom and answer to the last sender of mex. i dont know if i explained :-D |
https://www.cplusplus.com/doc/tutorial/preprocessor/
Look up how to use spiffs or littleFs. Not an issue with the library |
Good morning,
thank you for your library and sorry i'm a hobbist and then some Examples are quite complicated for me. here's my issue:
QUESTIONS:
"String chat_id = bot.messages[i].chat_id;"
so i can read it first time i write to the bot, the NodeMCU can store my id first time in EEPROM.
BUT chat_id you defined as STRING, i need it to be a Long Int, so what can i do to convert to it, store in eeprom and then read FROM EEPROM everytime it boot after power fail and convert again to string?
To avoid it, can your library send message to telegram and not to chat_id so everyone that are using the BOT can receive mexage automatically? something like "send to the chat" and not "send to the specified user"?
Thank you so much,
waiting for your help and sorry again for my inexperience, i'm a hobbist but not a beginner
The text was updated successfully, but these errors were encountered: