Added proper toke and username autocompletion.

This commit is contained in:
rainbow napkin 2025-01-04 11:19:24 -05:00
parent 23a71a5478
commit acbe0400c4
7 changed files with 76 additions and 20 deletions

View file

@ -41,6 +41,7 @@ module.exports = class{
await this.sendSiteEmotes();
await this.sendChanEmotes(chanDB);
await this.sendPersonalEmotes(userDB);
await this.sendUsedTokes(userDB);
//Tattoo hashed IP address to user account for seven days
await userDB.tattooIPRecord(socket.handshake.address);
@ -126,9 +127,9 @@ module.exports = class{
}
async sendPersonalEmotes(userDB){
//if we wherent handed a channel document
//if we wherent handed a user document
if(userDB == null){
//Pull it based on channel name
//Pull it based on user name
userDB = await userModel.findOne({user: this.user});
}
@ -139,6 +140,19 @@ module.exports = class{
this.emit('personalEmotes', emoteList);
}
async sendUsedTokes(userDB){
//if we wherent handed a user document
if(userDB == null){
//Pull it based on user name
userDB = await userModel.findOne({user: this.user});
}
//Create array of used toks from toke map and send it out to the user
this.emit('usedTokes',{
tokes: Array.from(userDB.tokes.keys())
});
}
updateFlair(flair){
this.flair = flair;