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