Per-Channel Emotes Implemented.

This commit is contained in:
rainbow napkin 2024-12-21 11:01:00 -05:00
parent 163cecf9f0
commit c3d016e1af
14 changed files with 483 additions and 20 deletions

View file

@ -56,6 +56,7 @@ module.exports = class{
//await this.sendClientMetadata(userDB, socket);
await userObj.sendClientMetadata();
await userObj.sendSiteEmotes();
await userObj.sendChanEmotes();
//Send out the userlist
this.broadcastUserList(socket.chan);
@ -101,4 +102,18 @@ module.exports = class{
this.server.io.in(this.name).emit("userList", userList);
}
async broadcastChanEmotes(chanDB){
//if we wherent handed a channel document
if(chanDB == null){
//Pull it based on channel name
chanDB = await channelModel.findOne({name: this.name});
}
//Get emote list from channel document
const emoteList = chanDB.getEmotes();
//Broadcast that sumbitch
this.server.io.in(this.name).emit('chanEmotes', emoteList);
}
}