29 lines
913 B
JavaScript
29 lines
913 B
JavaScript
|
const { SlashCommandBuilder } = require('discord.js');
|
||
|
const { simpleEmbed } = require('../functions/embeds.js');
|
||
|
const { Minecraft, Users } = require('../functions/models.js');
|
||
|
|
||
|
module.exports = {
|
||
|
data: new SlashCommandBuilder()
|
||
|
.setName('adduser')
|
||
|
.setDescription('Add a user to the system')
|
||
|
.addUserOption(option => option
|
||
|
.setName('user')
|
||
|
.setDescription('The user to add')),
|
||
|
|
||
|
async execute(interaction) {
|
||
|
const userId = interaction.options.getUser('user') ? interaction.options.getUser('user').id : interaction.user.id;
|
||
|
|
||
|
try {
|
||
|
await Users.create({
|
||
|
id: userId,
|
||
|
});
|
||
|
|
||
|
await interaction.reply({ embeds: [simpleEmbed('Added user to the system')], ephemeral: true });
|
||
|
} catch (error) {
|
||
|
console.error(error);
|
||
|
|
||
|
await interaction.reply({ embeds: [simpleEmbed('There was an error while adding the user')], ephemeral: true });
|
||
|
}
|
||
|
},
|
||
|
};
|