Finished --silent flag
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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])
|
||||
}
|
||||
|
||||
+1
-1
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user