Fix playerButtons + generatePlayer

This commit is contained in:
Zachary Guénot
2023-06-15 21:27:02 +02:00
parent 30bb35c4e7
commit 3e5a4cdff2
17 changed files with 145 additions and 164 deletions

View File

@@ -7,8 +7,17 @@ const playerButtons = require(appDir + '/utilsPlayer/buttons.js')
module.exports = {
name: Events.InteractionCreate,
async execute(interaction) {
if (!interaction.isAutocomplete() && !interaction.isChatInputCommand() && !interaction.isButton()) return console.error(`Interaction ${interaction.commandName} is not a command.`)
//if (!interaction.isAutocomplete() && !interaction.isChatInputCommand() && !interaction.isButton()) return console.error(`Interaction ${interaction.commandName} is not a command.`)
if (interaction.isChatInputCommand()) {
let command = interaction.client.commands.get(interaction.commandName)
if (!command) return console.error(`No command matching ${interaction.commandName} was found.`)
console.log(`\u001b[1;33m Command '${interaction.commandName}' launched by ${interaction.user.tag}`)
try { await command.execute(interaction) }
catch (error) { console.error(`Error executing ${interaction.commandName}:`, error) }
}
else if (interaction.isAutocomplete()) {
let autoCompleteRun = interaction.client.commands.get(interaction.commandName)
if (!autoCompleteRun) return console.error(`No autoCompleteRun matching ${interaction.commandName} was found.`)
@@ -18,17 +27,6 @@ module.exports = {
try { await autoCompleteRun.autocompleteRun(interaction) }
catch (error) { console.error(`Error autocompleting ${interaction.commandName}:`, error) }
}
else if (interaction.isChatInputCommand()) {
let command = interaction.client.commands.get(interaction.commandName)
if (!command) return console.error(`No command matching ${interaction.commandName} was found.`)
console.log(`\u001b[1;33m Command '${interaction.commandName}' launched by ${interaction.user.tag}`)
try { await command.execute(interaction) }
catch (error) { console.error(`Error executing ${interaction.commandName}:`, error) }
}
else if (interaction.isButton()) {
let button = interaction.client.buttons.get(interaction.customId)
if (!button) return console.error(`No button id matching ${interaction.customId} was found.`)