Finished --silent flag
This commit is contained in:
@@ -241,6 +241,8 @@ export class ODConsoleManager {
|
|||||||
historylength = 100
|
historylength = 100
|
||||||
/**An alias to the debugfile manager. (`otdebug.txt`) */
|
/**An alias to the debugfile manager. (`otdebug.txt`) */
|
||||||
debugfile: ODDebugFileManager
|
debugfile: ODDebugFileManager
|
||||||
|
/**Is silent mode enabled? */
|
||||||
|
silent: boolean = false
|
||||||
|
|
||||||
constructor(historylength:number, debugfile:ODDebugFileManager){
|
constructor(historylength:number, debugfile:ODDebugFileManager){
|
||||||
this.historylength = historylength
|
this.historylength = historylength
|
||||||
@@ -253,12 +255,12 @@ export class ODConsoleManager {
|
|||||||
log(message:string, type?:ODConsoleMessageTypes, params?:ODConsoleMessageParam[]): void
|
log(message:string, type?:ODConsoleMessageTypes, params?:ODConsoleMessageParam[]): void
|
||||||
log(message:ODConsoleMessage|ODError|string, type?:ODConsoleMessageTypes, params?:ODConsoleMessageParam[]){
|
log(message:ODConsoleMessage|ODError|string, type?:ODConsoleMessageTypes, params?:ODConsoleMessageParam[]){
|
||||||
if (message instanceof ODConsoleMessage){
|
if (message instanceof ODConsoleMessage){
|
||||||
message.render()
|
if (!this.silent) message.render()
|
||||||
if (this.debugfile) this.debugfile.writeConsoleMessage(message)
|
if (this.debugfile) this.debugfile.writeConsoleMessage(message)
|
||||||
this.history.push(message)
|
this.history.push(message)
|
||||||
|
|
||||||
}else if (message instanceof ODError){
|
}else if (message instanceof ODError){
|
||||||
message.render()
|
if (!this.silent) message.render()
|
||||||
if (this.debugfile) this.debugfile.writeErrorMessage(message)
|
if (this.debugfile) this.debugfile.writeErrorMessage(message)
|
||||||
this.history.push(message)
|
this.history.push(message)
|
||||||
|
|
||||||
@@ -272,7 +274,7 @@ export class ODConsoleManager {
|
|||||||
else if (type == "error") newMessage = new ODConsoleErrorMessage(message,params)
|
else if (type == "error") newMessage = new ODConsoleErrorMessage(message,params)
|
||||||
else newMessage = new ODConsoleSystemMessage(message,params)
|
else newMessage = new ODConsoleSystemMessage(message,params)
|
||||||
|
|
||||||
newMessage.render()
|
if (!this.silent) newMessage.render()
|
||||||
if (this.debugfile) this.debugfile.writeConsoleMessage(newMessage)
|
if (this.debugfile) this.debugfile.writeConsoleMessage(newMessage)
|
||||||
this.history.push(newMessage)
|
this.history.push(newMessage)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ export interface ODDefaults {
|
|||||||
crashOnError:boolean,
|
crashOnError:boolean,
|
||||||
/**Enable the system responsible for the `--debug` flag. */
|
/**Enable the system responsible for the `--debug` flag. */
|
||||||
debugLoading:boolean,
|
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. */
|
/**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,
|
allowDumpCommand:boolean,
|
||||||
/**Enable loading all Open Ticket plugins, sadly enough is only useful for the system :) */
|
/**Enable loading all Open Ticket plugins, sadly enough is only useful for the system :) */
|
||||||
@@ -233,6 +235,7 @@ export class ODDefaultsManager {
|
|||||||
errorHandling:true,
|
errorHandling:true,
|
||||||
crashOnError:false,
|
crashOnError:false,
|
||||||
debugLoading:true,
|
debugLoading:true,
|
||||||
|
silentLoading:true,
|
||||||
allowDumpCommand:true,
|
allowDumpCommand:true,
|
||||||
pluginLoading:true,
|
pluginLoading:true,
|
||||||
softPluginLoading:false,
|
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: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: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: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
|
//LEAVE MIGRATION CONTEXT
|
||||||
await unloadMigrationContext()
|
await unloadMigrationContext()
|
||||||
|
|||||||
@@ -115,6 +115,17 @@ const main = async () => {
|
|||||||
opendiscord.debug.visible = (debugFlag) ? debugFlag.value : false
|
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
|
//load progress bar renderers
|
||||||
opendiscord.log("Loading progress bars...","system")
|
opendiscord.log("Loading progress bars...","system")
|
||||||
if (opendiscord.defaults.getDefault("progressBarRendererLoading")){
|
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")
|
opendiscord.log("Please help us improve the translation by contributing to our project!","warning")
|
||||||
console.log("===================")
|
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])
|
await opendiscord.events.get("afterStartScreensRendered").emit([opendiscord.startscreen])
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -47,7 +47,7 @@
|
|||||||
"descriptionColor":"normal"
|
"descriptionColor":"normal"
|
||||||
},
|
},
|
||||||
"active":{
|
"active":{
|
||||||
"versions":["4.0.0"],
|
"versions":["4.0.0","4.0.1","4.0.2","4.0.3","4.0.4"],
|
||||||
"languages":[],
|
"languages":[],
|
||||||
"allLanguages":true,
|
"allLanguages":true,
|
||||||
"usingPlugins":true,
|
"usingPlugins":true,
|
||||||
|
|||||||
Reference in New Issue
Block a user