silvanus/slash-commands/compare.js

24 lines
768 B
JavaScript
Raw Permalink Normal View History

const { SlashCommandBuilder } = require('discord.js');
const fn = require('../modules/functions.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('compare')
.setDescription('See how your tree compares to other trees!'),
async execute(interaction) {
interaction.deferReply().then(() => {
2023-01-27 23:14:01 +00:00
fn.rankings.compare(interaction).then(async res => {
const refreshActionRow = await fn.builders.refreshAction(interaction.guildId);
const embed = fn.builders.comparisonEmbed(res, refreshActionRow);
interaction.editReply(embed).catch(err => {
console.error(err);
});
}).catch(err => {
interaction.editReply(fn.builders.errorEmbed(err)).catch(err => {
console.error(err);
});
console.error(err);
});
})
},
};