Made custom error message for invalid high-levels

This commit is contained in:
rainbow napkin 2026-10-01 01:13:51 -04:00
parent de392d8d57
commit fd7d9701db

View file

@ -53,6 +53,11 @@ class chatHandler{
* Max chat buffer message count * Max chat buffer message count
*/ */
this.chatBufferSize = 50; this.chatBufferSize = 50;
/**
* set max high level
*/
this.maxHighLevel = 10;
} }
/** /**
@ -123,6 +128,10 @@ class chatHandler{
if(userDB){ if(userDB){
try{ try{
if(data.highLevel < 0 || data.highLevel > this.maxHighLevel){
throw loggerUtils.exceptionSmith("Invalid High Level!", "High Level");
}
//Floor input to an integer and set high level //Floor input to an integer and set high level
userDB.highLevel = Math.floor(data.highLevel); userDB.highLevel = Math.floor(data.highLevel);
//Save user DB Document //Save user DB Document