Add debug messages, Add input sanitation to AddGear
This commit is contained in:
parent
55d999844b
commit
cd5530d6f3
11
src/index.js
11
src/index.js
@ -145,8 +145,10 @@ client.on('interactionCreate', async(interaction) => {
|
||||
message[1].edit(scoreBoardMessageIntern);
|
||||
replyMessage += "Updated Intern \n"
|
||||
}
|
||||
replyMessage += "Finished updating, it may take a few seconds to become visible."
|
||||
};
|
||||
interaction.reply({content: replyMessage, ephemeral: true});
|
||||
console.log("Finished updating scoreboard data, it may take a few seconds to display in the client.")
|
||||
})
|
||||
}
|
||||
} else if (interaction.commandName === 'scoreboard' && !isManager) {
|
||||
@ -167,13 +169,18 @@ function PromoteEmployee(Name, rank) {
|
||||
};
|
||||
|
||||
function AddGear(Type,Employee) {
|
||||
Type = Type.trim();
|
||||
Type = Type.toLowerCase();
|
||||
if (Type == "copper" || Type == "silver" || Type == "gold" || Type == "purple"){
|
||||
Type += "gear";
|
||||
}
|
||||
Type = Type.toLowerCase();
|
||||
if (Type != "coppergear" && Type != "silvergear" && Type != "goldgear" && Type != "purplegear") return "Nothing";
|
||||
if (Type != "coppergear" && Type != "silvergear" && Type != "goldgear" && Type != "purplegear") {
|
||||
console.log("User wrote an invalid gear type: " + Type)
|
||||
return "Nothing";
|
||||
}
|
||||
db.run(`UPDATE Employees SET ${Type} = ${Type} + 1 WHERE name = \'${Employee}\' `);
|
||||
|
||||
console.log("A gear of type: " + Type + " was added to " + Employee);
|
||||
return Type;
|
||||
};
|
||||
function RemoveGear(Type, Employee) {
|
||||
|
Loading…
Reference in New Issue
Block a user