diff --git a/server/BotCommandHandler.js b/server/BotCommandHandler.js index fc9251a..0179d02 100644 --- a/server/BotCommandHandler.js +++ b/server/BotCommandHandler.js @@ -57,19 +57,19 @@ module.exports = function(User, Message, Stream, IsCalledFromMultiplayer = false case "pp": responseMessage = "Set ranking mode to pp"; User.rankingMode = 0; - User.getNewUserInformationFromDatabase(); + User.updateUserInfo(true); break; case "score": responseMessage = "Set ranking mode to score"; User.rankingMode = 1; - User.getNewUserInformationFromDatabase(); + User.updateUserInfo(true); break; case "acc": responseMessage = "Set ranking mode to accuracy"; User.rankingMode = 2; - User.getNewUserInformationFromDatabase(); + User.updateUserInfo(true); break; } } diff --git a/server/User.js b/server/User.js index 1cb018e..93b80d8 100644 --- a/server/User.js +++ b/server/User.js @@ -65,7 +65,7 @@ module.exports = class { } // Gets the user's score information from the database and caches it - async getNewUserInformationFromDatabase(forceUpdate = false) { + async updateUserInfo(forceUpdate = false) { const userScoreDB = await global.DatabaseHelper.query(`SELECT * FROM users_modes_info WHERE user_id = ${this.id} AND mode_id = ${this.playMode} LIMIT 1`); const mappedRankingMode = rankingModes[this.rankingMode]; const userRankDB = await global.DatabaseHelper.query(`SELECT user_id, ${mappedRankingMode} FROM users_modes_info WHERE mode_id = ${this.playMode} ORDER BY ${mappedRankingMode} DESC`); diff --git a/server/loginHandler.js b/server/loginHandler.js index c7c6684..9746740 100644 --- a/server/loginHandler.js +++ b/server/loginHandler.js @@ -79,7 +79,7 @@ module.exports = async function(req, res, loginInfo) { NewUser.isTourneyUser = isTourneyClient; // Get user's data from the database - NewUser.getNewUserInformationFromDatabase(); + NewUser.updateUserInfo(); try { // Save the user's location to their class for later use diff --git a/server/serverHandler.js b/server/serverHandler.js index b30410e..8c9a120 100644 --- a/server/serverHandler.js +++ b/server/serverHandler.js @@ -34,10 +34,6 @@ setInterval(() => { // Logout this user, they're clearly gone. if (Date.now() >= User.timeoutTime) Logout(User); - - // The user is still here - else - User.getNewUserInformationFromDatabase(); } }, 10000);