Added tokelist to user profile.

This commit is contained in:
rainbow napkin 2024-12-14 07:03:25 -05:00
parent 0b84c51cbf
commit 80f0c5435f
6 changed files with 79 additions and 7 deletions

View file

@ -283,6 +283,20 @@ userSchema.methods.setFlair = async function(flair){
return flairDB;
}
userSchema.methods.getTokeCount = function(){
//Set tokeCount to 0
var tokeCount = 0;
//For each toke command the user has used
this.tokes.forEach((commandCount) => {
//Add the count for that specific command to the total
tokeCount += commandCount;
});
//Return the amount of tokes recorded
return tokeCount;
}
//note: if you gotta call this from a request authenticated by it's user, make sure to kill that session first!
userSchema.methods.killAllSessions = async function(reason = "A full log-out from all devices was requested for your account."){
//get authenticated sessions