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){
//Ensure the channel manager is actually up
if(server.channelManager != null){
//broadcast updated emotes //broadcast updated emotes
server.channelManager.broadcastSiteEmotes(); server.channelManager.broadcastSiteEmotes();
}
}); });
/** /**

View file

@ -36,8 +36,12 @@ 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")){
if(server.channelManager != null &&
server.channelManager.chatHandler != null &&
server.channelManager.chatHandler.chatPreprocessor == null){
//Get server tokebot object //Get server tokebot object
const tokebot = server.channelManager.chatHandler.chatPreprocessor.tokebot; const tokebot = server.channelManager.chatHandler.chatPreprocessor.tokebot;
@ -47,6 +51,7 @@ tokeCommandSchema.pre('save', async function (next){
tokebot.tokeCommands.push(this.command); tokebot.tokeCommands.push(this.command);
} }
} }
}
//All is good, continue on saving. //All is good, continue on saving.