diff --git a/events/interactionCreate.js b/events/interactionCreate.js index d514bad..7b06425 100644 --- a/events/interactionCreate.js +++ b/events/interactionCreate.js @@ -19,15 +19,6 @@ module.exports = new Event("interactionCreate", (client, interaction) => { if (interaction.user.bot || !interaction.isCommand() || !interaction.guild) return; - const args = [ - interaction.commandName, - ...client.commands - .find((cmd) => cmd.name.toLowerCase() == interaction.commandName) - .slashCommandOptions.map( - (v) => `${interaction.options.get(v.name).value}` - ), - ]; - const NotValid = new Discord.MessageEmbed() .setDescription(`:x: \`Invalid Command\` `) .setColor(supportbot.ErrorColour); @@ -49,23 +40,15 @@ module.exports = new Event("interactionCreate", (client, interaction) => { return interaction.reply({ embeds: [ValidPerms], }); - interaction.author = interaction.user; - command.run(interaction, args, client); + interaction.user = interaction.user; + command.run(interaction); } if (interaction.isButton()) { if (interaction.customId === "openticket") { - interaction.message.fetch(); - interaction.deferUpdate(); - let message = { - guild: client.guilds.cache.get(interaction.message.guildId), - author: client.users.cache.get(interaction.user.id), - content: "N/A", - channel: client.channels.cache.get(interaction.message.channelId), - }; try { const cmd = client.commands.get(cmdconfig.OpenTicket); if (!cmd) return; - cmd.run(message, message.content); + cmd.run(interaction); } catch (error) { console.error(error); } diff --git a/events/messageCreate.js b/events/messageCreate.js deleted file mode 100644 index e31caab..0000000 --- a/events/messageCreate.js +++ /dev/null @@ -1,50 +0,0 @@ -// SupportBot | Emerald Services -// Message Create Event - -const fs = require("fs"); - -const Discord = require("discord.js"); -const yaml = require('js-yaml'); -const supportbot = yaml.load(fs.readFileSync('./Data/supportbot.yml', 'utf8')); - -const Event = require("../Structures/Event.js"); - -module.exports = new Event("messageCreate", (client, message) => { - if (message.author.bot) return; - - if (!message.content.startsWith(client.prefix)) return; - - const args = message.content.substring(client.prefix.length).split(/ +/); - - const command = client.commands.find(cmd => cmd.name == args[0]); - - const NotValid = new Discord.MessageEmbed() - .setDescription(`:x: \`${args[0]}\` is an Invalid Command `) - .setColor(supportbot.ErrorColour) - - if (!command) return message.reply({ - embeds: [NotValid] - }); - - const OnlySlashCmd = new Discord.MessageEmbed() - .setDescription(`:warning: That command is only useable as a \`Slash Command\` `) - .setColor(supportbot.WarnColour) - - if (!["BOTH", "TEXT"].includes(command.type)) - return message.reply({ - embeds: [OnlySlashCmd] - }) - - const permission = message.member.permissions.has(command.permission, true); - - const ValidPerms = new Discord.MessageEmbed() - .setDescription(":x: Do you have the \`${command.permission}\` permissions to execute this command?") - .setColor(supportbot.ErrorColour) - - if (!permission) - return message.reply( - `You do not have the permission \`${command.permission}\` to run this command!` - ); - - command.run(message, args, client); -}); \ No newline at end of file