Finish Gear Removal Implementation
This commit is contained in:
parent
6ee679ffd4
commit
55d999844b
30
src/index.js
30
src/index.js
@ -52,6 +52,10 @@ client.on('interactionCreate', async(interaction) => {
|
||||
const gearAdded = AddGear(gearType, employee)
|
||||
interaction.reply({content: `Added a ${gearAdded} to ${employee}`, ephemeral: true})
|
||||
};
|
||||
if (addRemove == 'remove') {
|
||||
const gearRemoved = RemoveGear(gearType, employee)
|
||||
interaction.reply({content: `Removed a ${gearRemoved} from ${employee}`, ephemeral: true})
|
||||
}
|
||||
|
||||
} else if (interaction.commandName === 'gear' && !isManager) {
|
||||
interaction.reply({content:"You aren't a manager! Get back to work.", ephemeral: true})
|
||||
@ -130,32 +134,20 @@ client.on('interactionCreate', async(interaction) => {
|
||||
replyMessage += "Updated Muscle \n"
|
||||
}
|
||||
if (message[1].content.includes("# Moneymaker") && message[1].editable) {
|
||||
message[1].edit(scoreBoardMessageMuscle);
|
||||
message[1].edit(scoreBoardMessageMoneymaker);
|
||||
replyMessage += "Updated Moneymaker \n"
|
||||
}
|
||||
if (message[1].content.includes("# Mystic") && message[1].editable) {
|
||||
message[1].edit(scoreBoardMessageMuscle);
|
||||
message[1].edit(scoreBoardMessageMystic);
|
||||
replyMessage += "Updated Mystic \n"
|
||||
}
|
||||
if (message[1].content.includes("# Intern") && message[1].editable) {
|
||||
message[1].edit(scoreBoardMessageMuscle);
|
||||
message[1].edit(scoreBoardMessageIntern);
|
||||
replyMessage += "Updated Intern \n"
|
||||
}
|
||||
};
|
||||
interaction.reply({content: replyMessage, ephemeral: true});
|
||||
})
|
||||
/*
|
||||
const gearMessage = await messagesInGearchannel.find(msg => msg.author.id === '1306647733490290809' && msg.content.includes("#Beastboss"));
|
||||
|
||||
if (gearMessage === undefined) {
|
||||
interaction.reply({content: "Could not find a message to update, did you remember to display it first?", ephemeral: true});
|
||||
console.log(messagesInGearchannel);
|
||||
console.log(messagesInGearchannel.length())
|
||||
}
|
||||
else {
|
||||
gearMessage.edit(scoreBoardMessageBeastboss);
|
||||
interaction.reply("Updated scoreboard.")
|
||||
} */
|
||||
}
|
||||
} else if (interaction.commandName === 'scoreboard' && !isManager) {
|
||||
interaction.reply({content:"You aren't a manager! Get back to work.", ephemeral: true})
|
||||
@ -178,14 +170,20 @@ function AddGear(Type,Employee) {
|
||||
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";
|
||||
db.run(`UPDATE Employees SET ${Type} = ${Type} + 1 WHERE name = \'${Employee}\' `);
|
||||
|
||||
return Type;
|
||||
};
|
||||
function RemoveGear(Type, Employee) {
|
||||
if (Type != "coppergear" && Type != "silvergear" && Type != "goldgear" && Type != "purplegear") return
|
||||
if (Type == "copper" || Type == "silver" || Type == "gold" || Type == "purple"){
|
||||
Type += "gear";
|
||||
}
|
||||
if (Type != "coppergear" && Type != "silvergear" && Type != "goldgear" && Type != "purplegear") return "Nothing";
|
||||
db.run(`UPDATE Employees SET ${Type} = ${Type} - 1 WHERE name = \'${Employee}\'`)
|
||||
|
||||
return Type;
|
||||
};
|
||||
function RenameEmployee(oldName, newName) {
|
||||
db.run(`UPDATE Employees SET name = \'${newName}\' WHERE name = \'${oldName}\'`);
|
||||
|
Loading…
Reference in New Issue
Block a user