make xp not go into negative

This commit is contained in:
Jan 2021-03-16 14:26:39 +01:00
parent 991c46786f
commit f8d0bda580

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;