Compare commits
No commits in common. "6ee679ffd499c0267dff285bfc790e05f85b1d8e" and "eee43d2976cf1aebb3f2d441523dc9cd9f34333e" have entirely different histories.
6ee679ffd4
...
eee43d2976
85
src/index.js
85
src/index.js
@ -49,12 +49,12 @@ client.on('interactionCreate', async(interaction) => {
|
||||
const gearType = interaction.options.get('geartype').value;
|
||||
const employee = interaction.options.get('employee').value;
|
||||
if ( addRemove == 'add') {
|
||||
const gearAdded = AddGear(gearType, employee)
|
||||
interaction.reply({content: `Added a ${gearAdded} to ${employee}`, ephemeral: true})
|
||||
AddGear(gearType, employee)
|
||||
interaction.reply(`Added a gear to ${employee}`)
|
||||
};
|
||||
|
||||
} else if (interaction.commandName === 'gear' && !isManager) {
|
||||
interaction.reply({content:"You aren't a manager! Get back to work.", ephemeral: true})
|
||||
interaction.reply("You aren't a manager! Get back to work.")
|
||||
};
|
||||
|
||||
if (interaction.commandName === 'employee' && isManager) {
|
||||
@ -69,7 +69,7 @@ client.on('interactionCreate', async(interaction) => {
|
||||
interaction.reply(`Fired ${employeeName}`)
|
||||
}
|
||||
} else if (interaction.commandName === 'employee' && !isManager) {
|
||||
interaction.reply({content:"You aren't a manager! Get back to work.", ephemeral: true})
|
||||
interaction.reply("You aren't a manager! Get back to work.")
|
||||
};
|
||||
|
||||
if (interaction.commandName === 'promote' && isManager) {
|
||||
@ -78,7 +78,7 @@ client.on('interactionCreate', async(interaction) => {
|
||||
PromoteEmployee(employeeName, rank);
|
||||
interaction.reply(`Changed ${employeeName}\'s rank to ${rank}`);
|
||||
} else if (interaction.commandName === 'promote' && !isManager) {
|
||||
interaction.reply({content:"You aren't a manager! Get back to work.", ephemeral: true})
|
||||
interaction.reply("You aren't a manager! Get back to work.")
|
||||
};
|
||||
|
||||
if (interaction.commandName === 'rename' && isManager) {
|
||||
@ -91,74 +91,37 @@ client.on('interactionCreate', async(interaction) => {
|
||||
if (interaction.commandName === 'scoreboard' && isManager) {
|
||||
const updateOrDisplay = interaction.options.get('update-display').value;
|
||||
const gearchannel = client.channels.cache.get('1255024866797682779');
|
||||
let scoreBoardMessageBeastboss = await BuildScoreboard("Beastboss");
|
||||
let scoreBoardMessageManager = await BuildScoreboard("Manager");
|
||||
let scoreBoardMessageMuscle = await BuildScoreboard("Muscle");
|
||||
let scoreBoardMessageMoneymaker = await BuildScoreboard("Moneymaker");
|
||||
let scoreBoardMessageMystic = await BuildScoreboard("Mystic");
|
||||
let scoreBoardMessageIntern = await BuildScoreboard("Intern");
|
||||
let scoreBoardMessage = await BuildScoreboard("Beastboss");
|
||||
scoreBoardMessage += await BuildScoreboard("Manager");
|
||||
scoreBoardMessage += await BuildScoreboard("Muscle");
|
||||
scoreBoardMessage += await BuildScoreboard("Moneymaker");
|
||||
scoreBoardMessage += await BuildScoreboard("Mystic");
|
||||
scoreBoardMessage += await BuildScoreboard("Intern");
|
||||
if (updateOrDisplay == 'display') {
|
||||
//console.log("Scoreboard goes here: " + scoreBoardMessage);
|
||||
console.log("Scoreboard goes here: " + scoreBoardMessage);
|
||||
|
||||
if (scoreBoardMessageIntern != "") {
|
||||
gearchannel.send(scoreBoardMessageBeastboss);
|
||||
gearchannel.send(scoreBoardMessageManager);
|
||||
gearchannel.send(scoreBoardMessageMuscle);
|
||||
gearchannel.send(scoreBoardMessageMoneymaker);
|
||||
gearchannel.send(scoreBoardMessageMystic);
|
||||
gearchannel.send(scoreBoardMessageIntern);
|
||||
interaction.reply({content: "Displaying Scoreboard", ephemeral: true});
|
||||
if (scoreBoardMessage != "") {
|
||||
gearchannel.send(scoreBoardMessage);
|
||||
interaction.reply("Displaying Scoreboard");
|
||||
}
|
||||
else {
|
||||
console.log("Something went wrong when building the scoreboard.");
|
||||
};
|
||||
};
|
||||
if (updateOrDisplay == 'update') {
|
||||
gearchannel.messages.fetch().then((messages) => {
|
||||
let replyMessage = "";
|
||||
for (const message of messages) {
|
||||
if(message[1].content.includes("# Beastboss") && message[1].editable) {
|
||||
message[1].edit(scoreBoardMessageBeastboss);
|
||||
replyMessage += "Updated Beastboss \n"
|
||||
}
|
||||
if (message[1].content.includes("# Manager") && message[1].editable ) {
|
||||
message[1].edit(scoreBoardMessageManager);
|
||||
replyMessage += "Updated Manager \n"
|
||||
}
|
||||
if (message[1].content.includes("# Muscle") && message[1].editable) {
|
||||
message[1].edit(scoreBoardMessageMuscle);
|
||||
replyMessage += "Updated Muscle \n"
|
||||
}
|
||||
if (message[1].content.includes("# Moneymaker") && message[1].editable) {
|
||||
message[1].edit(scoreBoardMessageMuscle);
|
||||
replyMessage += "Updated Moneymaker \n"
|
||||
}
|
||||
if (message[1].content.includes("# Mystic") && message[1].editable) {
|
||||
message[1].edit(scoreBoardMessageMuscle);
|
||||
replyMessage += "Updated Mystic \n"
|
||||
}
|
||||
if (message[1].content.includes("# Intern") && message[1].editable) {
|
||||
message[1].edit(scoreBoardMessageMuscle);
|
||||
replyMessage += "Updated Intern \n"
|
||||
}
|
||||
};
|
||||
interaction.reply({content: replyMessage, ephemeral: true});
|
||||
})
|
||||
/*
|
||||
const gearMessage = await messagesInGearchannel.find(msg => msg.author.id === '1306647733490290809' && msg.content.includes("#Beastboss"));
|
||||
const messagesInGearchannel = await gearchannel.messages.fetch()
|
||||
const gearMessage = await messagesInGearchannel.find(msg => msg.author.id === '1306647733490290809')
|
||||
|
||||
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())
|
||||
interaction.reply("Could not find a message to update, did you remember to display it first?");
|
||||
}
|
||||
else {
|
||||
gearMessage.edit(scoreBoardMessageBeastboss);
|
||||
gearMessage.edit(scoreBoardMessage);
|
||||
interaction.reply("Updated scoreboard.")
|
||||
} */
|
||||
}
|
||||
}
|
||||
} else if (interaction.commandName === 'scoreboard' && !isManager) {
|
||||
interaction.reply({content:"You aren't a manager! Get back to work.", ephemeral: true})
|
||||
interaction.reply("You aren't a manager! Get back to work.")
|
||||
};
|
||||
});
|
||||
|
||||
@ -178,10 +141,8 @@ function AddGear(Type,Employee) {
|
||||
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;
|
||||
if (Type != "coppergear" && Type != "silvergear" && Type != "goldgear" && Type != "purplegear") return
|
||||
db.run(`UPDATE Employees SET ${Type} = ${Type} + 1 WHERE name = \'${Employee}\' `)
|
||||
};
|
||||
function RemoveGear(Type, Employee) {
|
||||
if (Type != "coppergear" && Type != "silvergear" && Type != "goldgear" && Type != "purplegear") return
|
||||
|
Loading…
Reference in New Issue
Block a user