Fixed errors loading default items

This commit is contained in:
rainbow napkin 2025-11-05 18:35:48 -05:00
parent eb5475ec9d
commit affdd98572
3 changed files with 18 additions and 10 deletions

View file

@ -9,7 +9,7 @@ Canopy
<a href="https://git.ourfore.st/rainbownapkin/canopy/issues" target="_blank"><img src="https://git.ourfore.st/rainbownapkin/canopy/badges/issues/closed.svg"></a> <a href="https://git.ourfore.st/rainbownapkin/canopy/issues" target="_blank"><img src="https://git.ourfore.st/rainbownapkin/canopy/badges/issues/closed.svg"></a>
<a href="https://www.gnu.org/licenses/agpl-3.0.en.html" target="_blank"><img src="https://img.shields.io/badge/License-AGPL_v3-663366.svg"></a> <a href="https://www.gnu.org/licenses/agpl-3.0.en.html" target="_blank"><img src="https://img.shields.io/badge/License-AGPL_v3-663366.svg"></a>
0.4-INDEV 0.4-INDEV Hotfix 1
========= =========
Canopy - /ˈkæ.nə.pi/: Canopy - /ˈkæ.nə.pi/:

View file

@ -51,8 +51,11 @@ const emoteSchema = new mongoose.Schema({
* Post-Save function, ensures all new emotes are broadcastes to actively connected clients * Post-Save function, ensures all new emotes are broadcastes to actively connected clients
*/ */
emoteSchema.post('save', async function (next){ emoteSchema.post('save', async function (next){
//broadcast updated emotes //Ensure the channel manager is actually up
server.channelManager.broadcastSiteEmotes(); if(server.channelManager != null){
//broadcast updated emotes
server.channelManager.broadcastSiteEmotes();
}
}); });
/** /**

View file

@ -36,15 +36,20 @@ const tokeCommandSchema = new mongoose.Schema({
* Pre-Save middleware, ensures tokebot receives all new toke commands * Pre-Save middleware, ensures tokebot receives all new toke commands
*/ */
tokeCommandSchema.pre('save', async function (next){ tokeCommandSchema.pre('save', async function (next){
//if the command was changed //if the channel manager, chat handler, and chat post-processor are all loaded up...
if(this.isModified("command")){ if(this.isModified("command")){
//Get server tokebot object if(server.channelManager != null &&
const tokebot = server.channelManager.chatHandler.chatPreprocessor.tokebot; server.channelManager.chatHandler != null &&
server.channelManager.chatHandler.chatPreprocessor == null){
//If tokebot is up and running //Get server tokebot object
if(tokebot != null && tokebot.tokeCommands != null){ const tokebot = server.channelManager.chatHandler.chatPreprocessor.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);
}
} }
} }