diff --git a/src/core/api/modules/console.ts b/src/core/api/modules/console.ts index fc634d6..f34399c 100644 --- a/src/core/api/modules/console.ts +++ b/src/core/api/modules/console.ts @@ -241,6 +241,8 @@ export class ODConsoleManager { historylength = 100 /**An alias to the debugfile manager. (`otdebug.txt`) */ debugfile: ODDebugFileManager + /**Is silent mode enabled? */ + silent: boolean = false constructor(historylength:number, debugfile:ODDebugFileManager){ this.historylength = historylength @@ -253,12 +255,12 @@ export class ODConsoleManager { log(message:string, type?:ODConsoleMessageTypes, params?:ODConsoleMessageParam[]): void log(message:ODConsoleMessage|ODError|string, type?:ODConsoleMessageTypes, params?:ODConsoleMessageParam[]){ if (message instanceof ODConsoleMessage){ - message.render() + if (!this.silent) message.render() if (this.debugfile) this.debugfile.writeConsoleMessage(message) this.history.push(message) }else if (message instanceof ODError){ - message.render() + if (!this.silent) message.render() if (this.debugfile) this.debugfile.writeErrorMessage(message) this.history.push(message) @@ -272,7 +274,7 @@ export class ODConsoleManager { else if (type == "error") newMessage = new ODConsoleErrorMessage(message,params) else newMessage = new ODConsoleSystemMessage(message,params) - newMessage.render() + if (!this.silent) newMessage.render() if (this.debugfile) this.debugfile.writeConsoleMessage(newMessage) this.history.push(newMessage) } diff --git a/src/core/api/modules/defaults.ts b/src/core/api/modules/defaults.ts index aaa0c47..63a9d68 100644 --- a/src/core/api/modules/defaults.ts +++ b/src/core/api/modules/defaults.ts @@ -13,6 +13,8 @@ export interface ODDefaults { crashOnError:boolean, /**Enable the system responsible for the `--debug` flag. */ debugLoading:boolean, + /**Enable the system responsible for the `--silent` flag. */ + silentLoading:boolean, /**When enabled, you're able to use the "!OPENTICKET:dump" command to send the OT debug file. This is only possible when you're the owner of the bot. */ allowDumpCommand:boolean, /**Enable loading all Open Ticket plugins, sadly enough is only useful for the system :) */ @@ -233,6 +235,7 @@ export class ODDefaultsManager { errorHandling:true, crashOnError:false, debugLoading:true, + silentLoading:true, allowDumpCommand:true, pluginLoading:true, softPluginLoading:false, diff --git a/src/core/startup/manageMigration.ts b/src/core/startup/manageMigration.ts index d08d833..8aeae49 100644 --- a/src/core/startup/manageMigration.ts +++ b/src/core/startup/manageMigration.ts @@ -48,6 +48,8 @@ export const loadVersionMigrationSystem = async () => { if (opendiscord.flags.exists("opendiscord:soft-plugins") && opendiscord.flags.get("opendiscord:soft-plugins").value) opendiscord.defaults.setDefault("softPluginLoading",true) if (opendiscord.flags.exists("opendiscord:crash") && opendiscord.flags.get("opendiscord:crash").value) opendiscord.defaults.setDefault("crashOnError",true) if (opendiscord.flags.exists("opendiscord:force-slash-update") && opendiscord.flags.get("opendiscord:force-slash-update").value) opendiscord.defaults.setDefault("forceSlashCommandRegistration",true) + if (opendiscord.flags.exists("opendiscord:silent") && opendiscord.flags.get("opendiscord:silent").value) opendiscord.console.silent = true + //LEAVE MIGRATION CONTEXT await unloadMigrationContext() diff --git a/src/index.ts b/src/index.ts index 92c80f2..33ed912 100644 --- a/src/index.ts +++ b/src/index.ts @@ -115,6 +115,17 @@ const main = async () => { opendiscord.debug.visible = (debugFlag) ? debugFlag.value : false } + //load silent mode + if (opendiscord.defaults.getDefault("silentLoading")){ + const silentFlag = opendiscord.flags.get("opendiscord:silent") + opendiscord.console.silent = (silentFlag) ? silentFlag.value : false + if (opendiscord.console.silent){ + opendiscord.console.silent = false + opendiscord.log("Silent mode is active! Logs won't be shown in the console.","warning") + opendiscord.console.silent = true + } + } + //load progress bar renderers opendiscord.log("Loading progress bars...","system") if (opendiscord.defaults.getDefault("progressBarRendererLoading")){ @@ -823,6 +834,11 @@ const main = async () => { opendiscord.log("Please help us improve the translation by contributing to our project!","warning") console.log("===================") } + if (opendiscord.console.silent){ + opendiscord.console.silent = false + opendiscord.log("Silent mode is active! Logs won't be shown in the console.","warning") + opendiscord.console.silent = true + } await opendiscord.events.get("afterStartScreensRendered").emit([opendiscord.startscreen]) } diff --git a/src/livestatus.json b/src/livestatus.json index fa02062..52efa22 100644 --- a/src/livestatus.json +++ b/src/livestatus.json @@ -47,7 +47,7 @@ "descriptionColor":"normal" }, "active":{ - "versions":["4.0.0"], + "versions":["4.0.0","4.0.1","4.0.2","4.0.3","4.0.4"], "languages":[], "allLanguages":true, "usingPlugins":true,