const { SlashCommandBuilder } = require('discord.js'); const { simpleEmbed } = require('../functions/embeds.js'); const { Minecraft, Users } = require('../functions/models.js'); module.exports = { data: new SlashCommandBuilder() .setName('removewhitelist') .setDescription('Remove yourself from the whitelist'), async execute(interaction) { try { const user = await Users.findOne({ where: { id: interaction.user.id } }); if (!user.minecraftUUID) return await interaction.reply({ embeds: [simpleEmbed('You are not whitelisted')], ephemeral: true }); await Minecraft.destroy({ where: { uuid: user.minecraftUUID } }); user.minecraftUUID = ''; await user.save(); await interaction.reply({ embeds: [simpleEmbed('Successfully removed you from the whitelist')], ephemeral: true }); } catch (error) { console.error(error); await interaction.reply({ embeds: [simpleEmbed('There was an error while removing user from the whitelist')], ephemeral: true }); } }, };