F33RNI / GPT-Telegramus

💜 The best free Telegram bot for ChatGPT, Microsoft Copilot (aka Bing AI / Sidney / EdgeGPT), Microsoft Copilot Designer (aka BingImageCreator), Gemini and Groq with stream writing, requests with images, multiple languages, admin control, data logging and more!
GNU Affero General Public License v3.0
318 stars 100 forks source link

Updater.py #115

Open chelaxian opened 6 months ago

chelaxian commented 6 months ago

can you create some updating mechanism to not redownload whole code after new release and rewrite all parameters and cookies and loses users statistics, but just launch some script that will catch all updated code automaticaly but save all your previous settings and statistics?

Hanssen0 commented 6 months ago

can you create some updating mechanism to not redownload whole code after new release and rewrite all parameters and cookies and loses users statistics, but just launch some script that will catch all updated code automaticaly but save all your previous settings and statistics?

Hi!

Did u tried to store your config & data files into a seperated path with your downloaded code? You can simply use the environment variable TELEGRAMUS_CONFIG_FILE or the --config cli option, and options in the config file's files field to specify your files' path.

Also you can try to use docker to run your application, see https://github.com/F33RNI/GPT-Telegramus?tab=readme-ov-file#-running-in-docker

chelaxian commented 6 months ago

can you create some updating mechanism to not redownload whole code after new release and rewrite all parameters and cookies and loses users statistics, but just launch some script that will catch all updated code automaticaly but save all your previous settings and statistics?

Hi!

Did u tried to store your config & data files into a seperated path with your downloaded code? You can simply use the environment variable TELEGRAMUS_CONFIG_FILE and options in the config file's files field to specify your files' path.

Also you can try to use docker to run your application, see https://github.com/F33RNI/GPT-Telegramus?tab=readme-ov-file#-running-in-docker

actualy i act like you said, but sometimes you change config.json also with release (like now in 4.0.0 you add Gemini), so you anyway need to refill this file again

Hanssen0 commented 6 months ago

actualy i act like you said, but sometimes you change config.json also with release (like now in 4.0.0 you add Gemini), so you anyway need to refill this file again

Yes that's a problem, and we're planning to make future changes optional when it's possible. Before we can actually do that, we might have some breaking changes since this project is still under development.

Sorry for the inconvenience.

chelaxian commented 3 months ago

here is my temporary solution to the problem:

crontab -e 30 4 * * * /root/github/GPT/update_GPT_Telegramus.sh

cat update_GPT_Telegramus.sh

#!/bin/bash

cd /root/github/GPT/
cp /root/github/GPT/GPT-Telegramus/config.json /root/github/GPT/BCK-CONF/
cp /root/github/GPT/GPT-Telegramus/users.json /root/github/GPT/BCK-CONF/
cp /root/github/GPT/GPT-Telegramus/module_configs/* /root/github/GPT/BCK-CONF/

rm -R /root/github/GPT/GPT-Telegramus-old/
mv /root/github/GPT/GPT-Telegramus /root/github/GPT/GPT-Telegramus-old/

cd /root/github/GPT/
git clone --recursive https://github.com/F33RNI/GPT-Telegramus

cp /root/github/GPT/BCK-CONF/config.json /root/github/GPT/GPT-Telegramus/
cp /root/github/GPT/BCK-CONF/users.json /root/github/GPT/GPT-Telegramus/
cp /root/github/GPT/BCK-CONF/*_cookies.json /root/github/GPT/GPT-Telegramus/
cp /root/github/GPT/BCK-CONF/lmao_*.json /root/github/GPT/GPT-Telegramus/module_configs/
cp /root/github/GPT/BCK-CONF/ms_copilo*.json /root/github/GPT/GPT-Telegramus/module_configs/
cp /root/github/GPT/BCK-CONF/gemini.json /root/github/GPT/GPT-Telegramus/module_configs/

cd GPT-Telegramus
chmod 777 run.sh

python3 -m venv venv

systemctl restart gpt-telegramus