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 gearType = interaction.options.get('geartype').value;
|
||||||
const employee = interaction.options.get('employee').value;
|
const employee = interaction.options.get('employee').value;
|
||||||
if ( addRemove == 'add') {
|
if ( addRemove == 'add') {
|
||||||
const gearAdded = AddGear(gearType, employee)
|
AddGear(gearType, employee)
|
||||||
interaction.reply({content: `Added a ${gearAdded} to ${employee}`, ephemeral: true})
|
interaction.reply(`Added a gear to ${employee}`)
|
||||||
};
|
};
|
||||||
|
|
||||||
} else if (interaction.commandName === 'gear' && !isManager) {
|
} 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) {
|
if (interaction.commandName === 'employee' && isManager) {
|
||||||
@ -69,7 +69,7 @@ client.on('interactionCreate', async(interaction) => {
|
|||||||
interaction.reply(`Fired ${employeeName}`)
|
interaction.reply(`Fired ${employeeName}`)
|
||||||
}
|
}
|
||||||
} else if (interaction.commandName === 'employee' && !isManager) {
|
} 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) {
|
if (interaction.commandName === 'promote' && isManager) {
|
||||||
@ -78,7 +78,7 @@ client.on('interactionCreate', async(interaction) => {
|
|||||||
PromoteEmployee(employeeName, rank);
|
PromoteEmployee(employeeName, rank);
|
||||||
interaction.reply(`Changed ${employeeName}\'s rank to ${rank}`);
|
interaction.reply(`Changed ${employeeName}\'s rank to ${rank}`);
|
||||||
} else if (interaction.commandName === 'promote' && !isManager) {
|
} 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) {
|
if (interaction.commandName === 'rename' && isManager) {
|
||||||
@ -91,74 +91,37 @@ client.on('interactionCreate', async(interaction) => {
|
|||||||
if (interaction.commandName === 'scoreboard' && isManager) {
|
if (interaction.commandName === 'scoreboard' && isManager) {
|
||||||
const updateOrDisplay = interaction.options.get('update-display').value;
|
const updateOrDisplay = interaction.options.get('update-display').value;
|
||||||
const gearchannel = client.channels.cache.get('1255024866797682779');
|
const gearchannel = client.channels.cache.get('1255024866797682779');
|
||||||
let scoreBoardMessageBeastboss = await BuildScoreboard("Beastboss");
|
let scoreBoardMessage = await BuildScoreboard("Beastboss");
|
||||||
let scoreBoardMessageManager = await BuildScoreboard("Manager");
|
scoreBoardMessage += await BuildScoreboard("Manager");
|
||||||
let scoreBoardMessageMuscle = await BuildScoreboard("Muscle");
|
scoreBoardMessage += await BuildScoreboard("Muscle");
|
||||||
let scoreBoardMessageMoneymaker = await BuildScoreboard("Moneymaker");
|
scoreBoardMessage += await BuildScoreboard("Moneymaker");
|
||||||
let scoreBoardMessageMystic = await BuildScoreboard("Mystic");
|
scoreBoardMessage += await BuildScoreboard("Mystic");
|
||||||
let scoreBoardMessageIntern = await BuildScoreboard("Intern");
|
scoreBoardMessage += await BuildScoreboard("Intern");
|
||||||
if (updateOrDisplay == 'display') {
|
if (updateOrDisplay == 'display') {
|
||||||
//console.log("Scoreboard goes here: " + scoreBoardMessage);
|
console.log("Scoreboard goes here: " + scoreBoardMessage);
|
||||||
|
|
||||||
if (scoreBoardMessageIntern != "") {
|
if (scoreBoardMessage != "") {
|
||||||
gearchannel.send(scoreBoardMessageBeastboss);
|
gearchannel.send(scoreBoardMessage);
|
||||||
gearchannel.send(scoreBoardMessageManager);
|
interaction.reply("Displaying Scoreboard");
|
||||||
gearchannel.send(scoreBoardMessageMuscle);
|
|
||||||
gearchannel.send(scoreBoardMessageMoneymaker);
|
|
||||||
gearchannel.send(scoreBoardMessageMystic);
|
|
||||||
gearchannel.send(scoreBoardMessageIntern);
|
|
||||||
interaction.reply({content: "Displaying Scoreboard", ephemeral: true});
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log("Something went wrong when building the scoreboard.");
|
console.log("Something went wrong when building the scoreboard.");
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
if (updateOrDisplay == 'update') {
|
if (updateOrDisplay == 'update') {
|
||||||
gearchannel.messages.fetch().then((messages) => {
|
const messagesInGearchannel = await gearchannel.messages.fetch()
|
||||||
let replyMessage = "";
|
const gearMessage = await messagesInGearchannel.find(msg => msg.author.id === '1306647733490290809')
|
||||||
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"));
|
|
||||||
|
|
||||||
if (gearMessage === undefined) {
|
if (gearMessage === undefined) {
|
||||||
interaction.reply({content: "Could not find a message to update, did you remember to display it first?", ephemeral: true});
|
interaction.reply("Could not find a message to update, did you remember to display it first?");
|
||||||
console.log(messagesInGearchannel);
|
|
||||||
console.log(messagesInGearchannel.length())
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
gearMessage.edit(scoreBoardMessageBeastboss);
|
gearMessage.edit(scoreBoardMessage);
|
||||||
interaction.reply("Updated scoreboard.")
|
interaction.reply("Updated scoreboard.")
|
||||||
} */
|
}
|
||||||
}
|
}
|
||||||
} else if (interaction.commandName === 'scoreboard' && !isManager) {
|
} 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"){
|
if (Type == "copper" || Type == "silver" || Type == "gold" || Type == "purple"){
|
||||||
Type += "gear";
|
Type += "gear";
|
||||||
}
|
}
|
||||||
if (Type != "coppergear" && Type != "silvergear" && Type != "goldgear" && Type != "purplegear") return "Nothing";
|
if (Type != "coppergear" && Type != "silvergear" && Type != "goldgear" && Type != "purplegear") return
|
||||||
db.run(`UPDATE Employees SET ${Type} = ${Type} + 1 WHERE name = \'${Employee}\' `);
|
db.run(`UPDATE Employees SET ${Type} = ${Type} + 1 WHERE name = \'${Employee}\' `)
|
||||||
|
|
||||||
return Type;
|
|
||||||
};
|
};
|
||||||
function RemoveGear(Type, Employee) {
|
function RemoveGear(Type, Employee) {
|
||||||
if (Type != "coppergear" && Type != "silvergear" && Type != "goldgear" && Type != "purplegear") return
|
if (Type != "coppergear" && Type != "silvergear" && Type != "goldgear" && Type != "purplegear") return
|
||||||
|
Loading…
Reference in New Issue
Block a user