فهرست منبع

Moves values from config.py to kofi.py. Copies default givebutter.py into instance folder.

deadtom 1 ماه پیش
والد
کامیت
2948a11010
1فایلهای تغییر یافته به همراه9 افزوده شده و 16 حذف شده
  1. 9 16
      upgrade.sh

+ 9 - 16
upgrade.sh

@@ -13,25 +13,18 @@ update_modules() {
 }
 
 update_config() {
-    local bak_file="instance/config.py.bak"
-
-    read -p "Enter the external URL your OwnchatBot uses, with \"https://\": " OCB_URL
-    
-    if [[ -n "$OCB_URL" ]]; then  # Check if OCB_URL is not empty
-        echo "" >> instance/config.py  # Append an empty line so it formats correctly
-        echo "OCB_URL = '$OCB_URL'" >> instance/config.py  # Append the new line
-        echo "Set OCB_URL successfully."
-        cp instance/config.py "$bak_file"
-        rm "$bak_file"  # Remove the .bak file if the update was successful
-    else
-        echo "Failed to set OCB_URL. Please provide a valid URL."
-        exit 1  # Exit the script with a non-zero status
-    fi
+    KOFI_TOKEN=$(grep "^KOFI_TOKEN" instance/config.py | cut -d'=' -f2 | cut -d'#' -f1 | tr -d '[:space:]')  # Get the value of KOFI_TOKEN
+    KOFI_INTEGRATION=$(grep "^KOFI_INTEGRATION" instance/config.py | cut -d'=' -f2 | cut -d'#' -f1 | tr -d '[:space:]')  # Get the value of KOFI_INTEGRATION    
+    sed -i "s/}/, \'token\': ${KOFI_TOKEN}, \'integration\': ${KOFI_INTEGRATION}}/" instance/kofi.py  # Append those values to kofi.py 
+    sed -i "/^KOFI_TOKEN/d" instance/config.py  # Delete KOFI_TOKEN line from config.py
+    sed -i "/^KOFI_INTEGRATION/d" instance/config.py  # Delete KOFI_INTEGRATION line from config.py
+
+    cp ownchatbot/defaults/givebutter.py instance/  # Copy the default givebutter config file into instance/
 }
 
 # activate_venv
 # update_modules
-update_config
 # deactivate
+update_config
 
-echo -e "Your OwnchatBot configuration has been upgraded. Happy streaming!"
+echo -e "\nYour OwnchatBot configuration has been upgraded. Look for GiveButter integration settings in the OCB Management Panel.\nHappy streaming!"