Fix scoreboard not displaying when above 2000 characters

This commit is contained in:
Alexandertp 2024-11-20 22:24:06 +01:00
parent ae61e4761f
commit e2ad1e18b4

View File

@ -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;
};