make xp not go into negative
This commit is contained in:
parent
991c46786f
commit
f8d0bda580
|
@ -35,6 +35,7 @@ client.on('message', async message => {
|
||||||
if (xpDiff !== 0) {
|
if (xpDiff !== 0) {
|
||||||
logger.debug(`${message.author} => ${xpDiff} XP`);
|
logger.debug(`${message.author} => ${xpDiff} XP`);
|
||||||
userLevels.xp += xpDiff;
|
userLevels.xp += xpDiff;
|
||||||
|
if (userLevels.xp < 0) userLevels.xp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
let newLevel = 0;
|
let newLevel = 0;
|
||||||
|
|
Loading…
Reference in a new issue