Made custom error message for invalid high-levels
This commit is contained in:
parent
de392d8d57
commit
fd7d9701db
1 changed files with 9 additions and 0 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue