WIP basic card dropping

This commit is contained in:
2022-08-18 19:24:44 +02:00
parent 29e3e6de23
commit ae60732836
13 changed files with 265 additions and 58 deletions

View File

@@ -2,10 +2,12 @@ require("dotenv").config();
const { REST } = require("@discordjs/rest");
const { Routes } = require("discord-api-types/v10")
const { Guild, User } = require("../models");
const { UserUtils } = require("../util");
module.exports = {
name: "interactionCreate",
async execute (interaction) {
if (!UserUtils.registrationCheck(interaction)) return;
if (!interaction.isCommand()) return;
const guild = await interaction.guild;
@@ -30,19 +32,6 @@ module.exports = {
});
}
//check if the user exists in the database, if not tell him to use the /register command
let user = await User.findOne({
where: {
discordId: interaction.member.id
}
});
if (!user && interaction.commandName !== "register") {
interaction.reply({
content: `You are not registered, use the /register command`,
ephemeral: false
});
return;
}
const command = interaction.client.commands.get(interaction.commandName);
@@ -53,7 +42,7 @@ module.exports = {
} catch (err) {
if (err) console.log(err);
await interaction.reply({
content: `An error occured processing the command :(\n \`\`\`${JSON.stringify(err, null, 2)}\`\`\``,
content: `An error occured processing the command :(\n \`\`\`${err.stack}\`\`\``,
ephemeral: false
});
}