2023-08-04 19:27:29 +02:00
|
|
|
const { SlashCommandBuilder } = require('discord.js');
|
|
|
|
const { simpleEmbed } = require('../functions/embeds.js');
|
2023-08-05 11:16:18 +02:00
|
|
|
const { Users } = require('../functions/models.js');
|
2023-08-04 19:27:29 +02:00
|
|
|
|
|
|
|
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 });
|
|
|
|
}
|
|
|
|
},
|
|
|
|
};
|