Fix where I broke /setup

This commit is contained in:
Skylar Grant 2023-01-23 21:50:30 -05:00
parent 14d46a8b29
commit 1433b723c3

View File

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