Fix where I broke /setup

This commit is contained in:
Skylar Grant 2023-01-23 21:50:30 -05:00
parent 14d46a8b29
commit 1433b723c3
1 changed files with 35 additions and 33 deletions

View File

@ -8,6 +8,7 @@ module.exports = {
.setName('setup') .setName('setup')
.setDescription('Attempt automatic configuration of the bot.'), .setDescription('Attempt automatic configuration of the bot.'),
execute(interaction) { execute(interaction) {
interaction.deferReply({ ephemeral: true }).then(function () {
if (guildInfo[interaction.guildId] == undefined) { if (guildInfo[interaction.guildId] == undefined) {
guildInfo[interaction.guildId] = { guildInfo[interaction.guildId] = {
"treeMessageId": "", "treeMessageId": "",
@ -19,7 +20,7 @@ module.exports = {
"rankings": [] "rankings": []
}; };
} }
interaction.channel.messages.fetch({ limit: 20 }).then(msgs => { interaction.channel.messages.fetch({ limit: 20 }).then(function (msgs) {
let treeFound = false; let treeFound = false;
let rankFound = false; let rankFound = false;
msgs.reverse().forEach(msg => { msgs.reverse().forEach(msg => {
@ -38,12 +39,13 @@ module.exports = {
} }
}); });
if (treeFound && !(rankFound)) { if (treeFound && !(rankFound)) {
interaction.reply(fn.builders.embed(strings.status.treeNoLeaderboard)); interaction.editReply(fn.builders.embed(strings.status.treeNoLeaderboard));
} else if (!(treeFound) && rankFound) { } else if (!(treeFound) && rankFound) {
interaction.reply(fn.builders.embed(strings.status.leaderboardNoTree)); interaction.editReply(fn.builders.embed(strings.status.leaderboardNoTree));
} else if (treeFound && rankFound) { } else if (treeFound && rankFound) {
interaction.reply(fn.builders.embed(strings.status.treeAndLeaderboard)); interaction.editReply(fn.builders.embed(strings.status.treeAndLeaderboard));
} }
}); });
});
}, },
}; };