You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#!/bin/bash
# Find the AwesomeChatGPTBot directory
AWESOME_CHAT_GPT_BOT_PATH=$(find / -type d -name "AwesomeChatGPTBot" 2>/dev/null | awk '!seen[$0]++')
# Check if the directory was found
if [ -z "$AWESOME_CHAT_GPT_BOT_PATH" ]; then
echo "Directory AwesomeChatGPTBot not found."
exit 1
fi
# Define the backup config directory path
BACKUP_CONFIG_DIR=$(dirname "$AWESOME_CHAT_GPT_BOT_PATH")/BACKUP-CONFIG
# Create the backup config directory if it doesn't exist
mkdir -p "$BACKUP_CONFIG_DIR"
# Copy the token.txt file from the found directory to BACKUP-CONFIG
cp "$AWESOME_CHAT_GPT_BOT_PATH"/token.txt "$BACKUP_CONFIG_DIR"/
# Backup the Accounts directory and its contents
cp -R "$AWESOME_CHAT_GPT_BOT_PATH"/Accounts "$BACKUP_CONFIG_DIR"/
# Remove the old AwesomeChatGPTBot directory if it exists
if [ -d "$AWESOME_CHAT_GPT_BOT_PATH"-old ]; then
rm -rf "$AWESOME_CHAT_GPT_BOT_PATH"-old
fi
# Backup current version of AwesomeChatGPTBot before updating
mv "$AWESOME_CHAT_GPT_BOT_PATH" "$AWESOME_CHAT_GPT_BOT_PATH"-old
# Clone the new version of AwesomeChatGPTBot from the repository
git clone https://github.com/Kourva/AwesomeChatGPTBot "$AWESOME_CHAT_GPT_BOT_PATH"
# Copy back the token.txt file
cp "$BACKUP_CONFIG_DIR"/token.txt "$AWESOME_CHAT_GPT_BOT_PATH"/
# Restore the Accounts directory from backup
cp -R "$BACKUP_CONFIG_DIR"/Accounts "$AWESOME_CHAT_GPT_BOT_PATH"/
# Change to the directory with the new version of AwesomeChatGPTBot
cd "$AWESOME_CHAT_GPT_BOT_PATH" || exit
# Provide permissions to the Accounts directory
chmod -R 777 Accounts/
# Run the initialization script
python3 init.py
# Restart the telegram_bot service
systemctl restart telegram_bot.service
chmod 777 ~/updater_tg_gpt.sh
The text was updated successfully, but these errors were encountered:
Wait, that’s awesome! Thank you. I will add them to the repository. Also, I should include a function to check for updates. Perhaps it could be in a file called version.txt.
Additionally, I could make it compatible with other init systems like OpenRC and maybe even Runit.
i created auto-updater for your project
crontab -e
0 4 * * * ~/updater_tg_gpt.sh
nano ~/updater_tg_gpt.sh
chmod 777 ~/updater_tg_gpt.sh
The text was updated successfully, but these errors were encountered: