diff --git a/.gitignore b/.gitignore index 6530cd8..d15d9ec 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ log/crash/* www/doc/*/* package-lock.json config.json +config.json.old state.json chatexamples.txt server.cert diff --git a/config.example.jsonc b/config.example.jsonc index 818ca58..544e906 100644 --- a/config.example.jsonc +++ b/config.example.jsonc @@ -17,7 +17,7 @@ //Dailymotion and Vimeo could work using official apis w/o keys, but you wouldn't have any raw file playback options :P "ytdlpPath": "/home/canopy/.local/pipx/venvs/yt-dlp/bin/yt-dlp", //Be careful with what you keep in secrets, you should use special chars, but test your deployment, as some chars may break account registration - //An update to either kill the server and bitch it's planned so it's not so confusing for new admins + //An update to either kill the server and bitch about the issue in console is planned so it's not so confusing for new admins //Session secret used to secure session keys "sessionSecret": "CHANGE_ME", //Altacha secret used to generate altcha challenges diff --git a/src/schemas/tokebot/tokeCommandSchema.js b/src/schemas/tokebot/tokeCommandSchema.js index 164127f..a6e9715 100644 --- a/src/schemas/tokebot/tokeCommandSchema.js +++ b/src/schemas/tokebot/tokeCommandSchema.js @@ -20,6 +20,7 @@ const {mongoose} = require('mongoose'); //Local Imports const defaultTokes = require("../../../defaultTokes.json"); const server = require('../../server'); +const loggerUtils = require('../../utils/loggerUtils'); /** * Mongoose Schema representing a toke command @@ -40,8 +41,11 @@ tokeCommandSchema.pre('save', async function (next){ //Get server tokebot object const tokebot = server.channelManager.chatHandler.commandPreprocessor.tokebot; - //Pop the command on to the end - tokebot.tokeCommands.push(this.command); + //If tokebot is up and running + if(tokebot != null && tokebot.tokeCommands != null){ + //Pop the command on to the end + tokebot.tokeCommands.push(this.command); + } } @@ -92,6 +96,7 @@ tokeCommandSchema.statics.loadDefaults = async function(){ //Ensure default comes first (.bind(this) doesn't seem to work here...) await registerToke(defaultTokes.default); + //For each entry in the defaultTokes.json file defaultTokes.array.forEach(registerToke); @@ -108,9 +113,9 @@ tokeCommandSchema.statics.loadDefaults = async function(){ }catch(err){ if(toke != null){ - console.log(`Error loading toke command: '!${toke}'`); + loggerUtils.dumpError(err); }else{ - console.log("Error, null toke!"); + loggerUtils.consoleWarn("Error, null toke!"); } } }