this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: enhance update command to stash local changes, pull latest code, and improve error handling

+24 -2
+24 -2
README.md
··· 293 293 - `/recache` - Recache missing files and remove items that fail after 3 attempts 294 294 - `/announce` - Create a new announcement (with custom text and schedule) 295 295 - `/announcements` - Manage existing announcements (view, edit, delete) 296 - - `/update` - Check for updates and apply them (owner only) 296 + - `/update` - Check for updates, stash changes, pull latest code, and restart bot (owner only) 297 297 298 298 ### Adding Images to Queue 299 299 ··· 408 408 - **Owner-Only**: Update command is restricted to the bot owner 409 409 - **Dev Mode Exclusion**: Auto-updater is disabled in development mode 410 410 411 - The updater runs in the background and will notify you when updates are applied. 411 + #### Update Flow 412 + 413 + When an update is triggered (either automatically or via `/update` command), the bot follows this process: 414 + 415 + 1. **Stash Local Changes**: Any uncommitted local modifications are automatically stashed to prevent conflicts 416 + 2. **Fetch Remote Changes**: Retrieves the latest commits from the remote repository 417 + 3. **Check for Updates**: Verifies if there are new commits to pull 418 + 4. **Pull Changes**: Applies the updates using `git pull` 419 + 5. **Save Queue**: Forces a save of the current queue to disk to prevent data loss 420 + 6. **Display Commit Info**: Shows the latest commit message with author and timestamp 421 + 7. **Restart Bot**: Gracefully restarts the bot via PM2 with updated environment variables 422 + 423 + #### Error Handling 424 + 425 + Each step in the update process includes comprehensive error handling: 426 + 427 + - **Stash Failures**: Reports if local changes cannot be stashed 428 + - **Fetch Failures**: Reports connection or repository access issues 429 + - **Pull Failures**: Reports merge conflicts or pull errors 430 + - **Restart Failures**: Provides instructions to manually restart if PM2 fails 431 + - **Descriptive Messages**: Each error includes specific information about what went wrong 432 + 433 + The updater handles the normal PM2 `SIGINT` signal correctly and won't report it as an error during successful restarts. 412 434 413 435 ### Media Recaching 414 436