Implemented custom per-channel !toke commands in back-end.
This commit is contained in:
parent
575244ac53
commit
a1fbbea7b7
10 changed files with 159 additions and 29 deletions
|
|
@ -20,9 +20,10 @@ const flairModel = require('../../schemas/flairSchema');
|
|||
const permissionModel = require('../../schemas/permissionSchema');
|
||||
|
||||
module.exports = class{
|
||||
constructor(server, name){
|
||||
constructor(server, chanDB){
|
||||
this.server = server;
|
||||
this.name = name;
|
||||
this.name = chanDB.name;
|
||||
this.tokeCommands = chanDB.tokeCommands;
|
||||
//Keeping these in a map was originally a vestige but it's more preformant than an array or object so :P
|
||||
this.userList = new Map();
|
||||
}
|
||||
|
|
@ -37,8 +38,11 @@ module.exports = class{
|
|||
if(userObj){
|
||||
//Add this socket on to the userobject
|
||||
userObj.sockets.push(socket.id);
|
||||
//If the user is joining the channel
|
||||
}else{
|
||||
//Grab flair
|
||||
await userDB.populate('flair');
|
||||
//Set user object
|
||||
userObj = new connectedUser(userDB, chanRank, this, socket);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue