Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request makes several improvements to bot shutdown and message purge handling across multiple bot modules. The main focus is on ensuring bots close gracefully, removing unnecessary forced exits, and improving the management of auto-purge tasks for admin and logger bots. Additionally, minor robustness improvements and code cleanups are made for image generation and command handling.
Graceful Bot Shutdown
await bot.close()andsys.exit(0)with checks to ensure bots are only closed if not already closed, across all bot modules (e.g.,bot.py,chatgpt_bot.py,llama_bot.py, etc.), resulting in more robust and predictable shutdown behavior. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16]SystemExitcalls after shutdown, letting the process exit naturally. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16]Auto-Purge Task Management
close_bot()methods to handle task cancellation and bot closure. [1] [2] [3] [4]Command and Admin Improvements
/clearand auto-purge command logic to simplify error handling, improve robustness, and clarify user feedback messages./restartand/stopadmin commands to use astop.jsonfile for signaling process management, removing direct bot closure and exit calls for better external control. [1] [2]Minor Robustness & Cleanup
These changes collectively improve the reliability, maintainability, and operational control of bot processes and automated message management.