Fix scoreboard update to work with new display.

This commit is contained in:
Alexandertp 2024-11-20 22:24:30 +01:00
parent e2ad1e18b4
commit 6ee679ffd4

View File

@ -114,16 +114,48 @@ client.on('interactionCreate', async(interaction) => {
}; };
}; };
if (updateOrDisplay == 'update') { if (updateOrDisplay == 'update') {
const messagesInGearchannel = await gearchannel.messages.fetch() gearchannel.messages.fetch().then((messages) => {
const gearMessage = await messagesInGearchannel.find(msg => msg.author.id === '1306647733490290809') 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"));
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({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 { else {
gearMessage.edit(scoreBoardMessage); gearMessage.edit(scoreBoardMessageBeastboss);
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({content:"You aren't a manager! Get back to work.", ephemeral: true})