make xp not go into negative

master
Jan 2021-03-16 14:26:39 +01:00
parent 991c46786f
commit f8d0bda580
1 changed files with 1 additions and 0 deletions

View File

@ -35,6 +35,7 @@ client.on('message', async message => {
if (xpDiff !== 0) {
logger.debug(`${message.author} => ${xpDiff} XP`);
userLevels.xp += xpDiff;
if (userLevels.xp < 0) userLevels.xp = 0;
}
let newLevel = 0;