Skip to content
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

Closed
konig87nikkinakki opened this issue Jun 22, 2021 · 3 comments
Closed

store chat_id into EEPROM #247

konig87nikkinakki opened this issue Jun 22, 2021 · 3 comments

Comments

@konig87nikkinakki
Copy link

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

@witnessmenow
Copy link
Owner

witnessmenow commented Jun 22, 2021 via email

@konig87nikkinakki
Copy link
Author

konig87nikkinakki commented Jun 22, 2021

thank you for fast reply, really!
i ve seen the ESP32 example and could really work fine for me :-) Questions:
#define CHAT_ID "175753388"
so what is CHAT_ID ? string? int? does it work if i try with
#const long int = 175753388;
or
long int = 175753388;
Everytime i program, i try to avoid to use #define because i really dont know how-arduino-see-it ;-) thanks

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

@witnessmenow
Copy link
Owner

#define CHAT_ID "175753388"
so what is CHAT_ID ? string? int? does it work if i try with
#const long int = 175753388;
or
long int = 175753388;

https://www.cplusplus.com/doc/tutorial/preprocessor/

Everytime i program, i try to avoid to use #define because i really dont know how-arduino-see-it ;-) thanks

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

Look up how to use spiffs or littleFs.

Not an issue with the library

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants