def exit_bot(): from JJMumbleBot.lib.utils import dir_utils if global_settings.mumble_inst: global_settings.gui_service.quick_gui( f"{get_bot_name()} is being shutdown.", text_type='header', box_align='left', ignore_whisper=True, ) for plugin in global_settings.bot_plugins.values(): plugin.quit() if global_settings.flask_server: global_settings.flask_server.stop() dprint("Terminated flask server instance.", origin=L_SHUTDOWN) if global_settings.socket_server: global_settings.socket_server = None dprint("Terminated web socket server instance.", origin=L_SHUTDOWN) if global_settings.audio_inst: global_settings.audio_inst.kill() global_settings.audio_inst = None global_settings.aud_interface.exit_flag = True dprint("Terminated audio web interface instance.", origin=L_SHUTDOWN) dir_utils.clear_directory(dir_utils.get_temp_med_dir()) dprint("Cleared temporary directories on shutdown.") log(INFO, "Cleared temporary directories on shutdown.", origin=L_SHUTDOWN) global_settings.exit_flag = True
def exit_bot(): from JJMumbleBot.lib.utils import dir_utils global_settings.gui_service.quick_gui( f"{get_bot_name()} is being shutdown.", text_type='header', box_align='left', ignore_whisper=True, ) for plugin in global_settings.bot_plugins.values(): plugin.quit() dir_utils.clear_directory(dir_utils.get_temp_med_dir()) dprint("Cleared temporary directories on shutdown.") log(INFO, "Cleared temporary directories on shutdown.", origin=L_SHUTDOWN) global_settings.exit_flag = True
def exit_bot_error(error_code: ExitCodes): if global_settings.mumble_inst: global_settings.gui_service.quick_gui( f"{get_bot_name()} has encountered an error and is being shutdown.<br>Please check the bot logs/console." f"<br>Exit Code: {error_code.value}", text_type='header', box_align='center', ignore_whisper=True, ) try: for plugin in global_settings.bot_plugins.values(): plugin.quit() except AttributeError: pass dir_utils.clear_directory(dir_utils.get_temp_med_dir()) log(INFO, "Cleared temporary directories on shutdown.", origin=L_SHUTDOWN, print_mode=PrintMode.VERBOSE_PRINT.value) global_settings.exit_flag = True
def exit_bot(): if global_settings.mumble_inst: global_settings.gui_service.quick_gui( f"{get_bot_name()} is being shutdown.", text_type='header', box_align='left', ignore_whisper=True, ) for plugin in global_settings.bot_plugins.values(): plugin.quit() if global_settings.audio_inst: global_settings.audio_inst.kill() global_settings.audio_inst = None global_settings.aud_interface.exit_flag = True log(INFO, "Terminated audio interface instance.", origin=L_SHUTDOWN, print_mode=PrintMode.REG_PRINT.value) dir_utils.clear_directory(dir_utils.get_temp_med_dir()) log(INFO, "Cleared temporary directories on shutdown.", origin=L_SHUTDOWN, print_mode=PrintMode.VERBOSE_PRINT.value) global_settings.exit_flag = True