Finished up with chat prompt autocomplete.
This commit is contained in:
parent
acbe0400c4
commit
9df7f52e9e
7 changed files with 197 additions and 100 deletions
|
|
@ -41,6 +41,8 @@ module.exports = class{
|
|||
await this.sendSiteEmotes();
|
||||
await this.sendChanEmotes(chanDB);
|
||||
await this.sendPersonalEmotes(userDB);
|
||||
|
||||
//Send out used tokes
|
||||
await this.sendUsedTokes(userDB);
|
||||
|
||||
//Tattoo hashed IP address to user account for seven days
|
||||
|
|
@ -64,7 +66,12 @@ module.exports = class{
|
|||
//at the end of the day there has to be some penance for decent multi-session handling on-top of a library that doesn't do it.
|
||||
//Having to crawl through these sockets is that. Because the other ways seem more gross somehow.
|
||||
emit(eventName, args){
|
||||
this.socketCrawl((socket)=>{socket.emit(eventName, args)});
|
||||
this.socketCrawl((socket)=>{
|
||||
//Ensure our socket is initialized
|
||||
if(socket != null){
|
||||
socket.emit(eventName, args);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//generic disconnect function, defaults to kick
|
||||
|
|
@ -73,11 +80,33 @@ module.exports = class{
|
|||
this.socketCrawl((socket)=>{socket.disconnect()});
|
||||
}
|
||||
|
||||
async sendClientMetadata(){
|
||||
//This is the big first push upon connection
|
||||
//It should only fire once, so things that only need to be sent once can be slapped into here
|
||||
async sendClientMetadata(userDB, chanDB){
|
||||
//Get flairList from DB and setup flairList array
|
||||
const flairListDB = await flairModel.find({});
|
||||
var flairList = [];
|
||||
|
||||
//if we wherent handed a user document
|
||||
if(userDB == null){
|
||||
//Pull it based on user name
|
||||
userDB = await userModel.findOne({user: this.user});
|
||||
}
|
||||
|
||||
//if we wherent handed a channel document
|
||||
if(chanDB == null){
|
||||
//Pull it based on channel name
|
||||
chanDB = await channelModel.findOne({name: this.channel.name});
|
||||
}
|
||||
|
||||
//If our perm map is un-initiated
|
||||
//can't set this in constructor easily since it's asyncornous
|
||||
//need to wait for it to complete before sending this off, but shouldnt re-do the wait for later connections
|
||||
if(this.permMap == null){
|
||||
//Grab perm map
|
||||
this.permMap = await chanDB.getPermMapByUserDoc(userDB);
|
||||
}
|
||||
|
||||
//Setup our userObj
|
||||
const userObj = {
|
||||
id: this.id,
|
||||
|
|
@ -85,7 +114,11 @@ module.exports = class{
|
|||
rank: this.rank,
|
||||
chanRank: this.chanRank,
|
||||
highLevel: this.highLevel,
|
||||
flair: this.flair
|
||||
permMap: {
|
||||
site: Array.from(this.permMap.site),
|
||||
chan: Array.from(this.permMap.chan),
|
||||
},
|
||||
flair: this.flair,
|
||||
}
|
||||
|
||||
//For each flair listed in the Database
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue