diff --git a/src/index.js b/src/index.js index bf0b13a..2f6c566 100644 --- a/src/index.js +++ b/src/index.js @@ -114,16 +114,48 @@ client.on('interactionCreate', async(interaction) => { }; }; if (updateOrDisplay == 'update') { - const messagesInGearchannel = await gearchannel.messages.fetch() - const gearMessage = await messagesInGearchannel.find(msg => msg.author.id === '1306647733490290809') + 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")); 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(scoreBoardMessage); + 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})