-2

I am making a telegram bot who will work like schedule and it is deployed on heroku. When server is restarting, chat id is clearing and the bot is not working

So I have a question. Can I somehow get chat id without user message? And is it even real?

boozebe
  • 1
  • 3

1 Answers1

0

you must back up those id's and your session files

the session file contains information about all your interactions with telegram (chats , massages ,....)

before server restarts , save the session files remember saving the session files and coping them again to their directory after the restart is like nothing has happend to the bot , because everything is saved into these files .

connect your bot to a database system . mysql ,..... or just save chat id (or peer id ) number (which is inside the update array ) into a file (txt , json ,...) then use them after server restarts .

if you lose the session files it's like the memory of bot is erased

aboss
  • 520
  • 1
  • 4
  • 14