From e2ad1e18b414a67ea004e2716820f50f41aeed06 Mon Sep 17 00:00:00 2001 From: Alexandertp Date: Wed, 20 Nov 2024 22:24:06 +0100 Subject: [PATCH] Fix scoreboard not displaying when above 2000 characters --- src/index.js | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/index.js b/src/index.js index abc85a1..bf0b13a 100644 --- a/src/index.js +++ b/src/index.js @@ -91,17 +91,22 @@ 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 scoreBoardMessage = await BuildScoreboard("Beastboss"); - scoreBoardMessage += await BuildScoreboard("Manager"); - scoreBoardMessage += await BuildScoreboard("Muscle"); - scoreBoardMessage += await BuildScoreboard("Moneymaker"); - scoreBoardMessage += await BuildScoreboard("Mystic"); - scoreBoardMessage += await BuildScoreboard("Intern"); + 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"); if (updateOrDisplay == 'display') { - console.log("Scoreboard goes here: " + scoreBoardMessage); + //console.log("Scoreboard goes here: " + scoreBoardMessage); - if (scoreBoardMessage != "") { - gearchannel.send(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}); } else { @@ -141,8 +146,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 - db.run(`UPDATE Employees SET ${Type} = ${Type} + 1 WHERE name = \'${Employee}\' `) + if (Type != "coppergear" && Type != "silvergear" && Type != "goldgear" && Type != "purplegear") return "Nothing"; + db.run(`UPDATE Employees SET ${Type} = ${Type} + 1 WHERE name = \'${Employee}\' `); return Type; };