Added site-wide emote support.
This commit is contained in:
parent
41d0302ded
commit
97717b525c
11 changed files with 122 additions and 22 deletions
|
|
@ -19,6 +19,7 @@ const {mongoose} = require('mongoose');
|
|||
|
||||
//Local Imports
|
||||
const defaultEmote = require("../../defaultEmotes.json");
|
||||
const server = require('../server');
|
||||
|
||||
const typeEnum = ["image", "video"];
|
||||
|
||||
|
|
@ -39,6 +40,19 @@ const emoteSchema = new mongoose.Schema({
|
|||
}
|
||||
});
|
||||
|
||||
//pre-save function
|
||||
emoteSchema.post('save', async function (next){
|
||||
//broadcast updated emotes
|
||||
server.channelManager.broadcastSiteEmotes();
|
||||
});
|
||||
|
||||
//post-delete function (document not query)
|
||||
emoteSchema.post('deleteOne', {document: true}, async function (next){
|
||||
//broadcast updated emotes
|
||||
server.channelManager.broadcastSiteEmotes();
|
||||
});
|
||||
|
||||
//statics
|
||||
emoteSchema.statics.loadDefaults = async function(){
|
||||
//Make sure registerEmote function is happy
|
||||
const _this = this;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue