Panda
Panda
DIAdiscord.js - Imagine an app
Created by Panda on 6/21/2023 in #djs-questions
SequelizeDatabaseError because of array?
Ah my bad, ill repost there
6 replies
DIAdiscord.js - Imagine an app
Created by Panda on 6/21/2023 in #djs-questions
SequelizeDatabaseError because of array?
bump?
6 replies
DIAdiscord.js - Imagine an app
Created by Panda on 6/21/2023 in #djs-questions
SequelizeDatabaseError because of array?
[email protected] & node v18.12.1
6 replies
DIAdiscord.js - Imagine an app
Created by Panda on 6/20/2023 in #djs-questions
Using Buttons Properly
Im trying to find this in the documentation but im honestly failing to find where its stated
6 replies
DIAdiscord.js - Imagine an app
Created by Panda on 6/20/2023 in #djs-questions
Using Buttons Properly
[email protected] and node v18.12.1
6 replies
DIAdiscord.js - Imagine an app
Created by Panda on 6/20/2023 in #djs-questions
Using Buttons Properly
module.exports = {
name: Events.InteractionCreate,
/**
* @param {Interaction} interaction
*/
async execute(interaction) {
if (interaction.isChatInputCommand()) {
const command = interaction.client.commands.get(interaction.commandName);

if (!command) {
console.error(
`No command matching ${interaction.commandName} was found.`
);
return;
}

try {
await command.execute(interaction);
} catch (error) {
console.error(`Error executing ${interaction.commandName}`);
console.error(error);
}
}
},
};
module.exports = {
name: Events.InteractionCreate,
/**
* @param {Interaction} interaction
*/
async execute(interaction) {
if (interaction.isChatInputCommand()) {
const command = interaction.client.commands.get(interaction.commandName);

if (!command) {
console.error(
`No command matching ${interaction.commandName} was found.`
);
return;
}

try {
await command.execute(interaction);
} catch (error) {
console.error(`Error executing ${interaction.commandName}`);
console.error(error);
}
}
},
};
interactionCreate.js I was wondering how I would add buttons into this thinKappa
if (interaction.isButton()) {
const button = client.buttons.get(interaction.customId);
if (!button) return;

try {
await button.execute(interaction);
} catch (error) {
console.error(error);
await interaction.reply({
content: "There was an error while executing the button script !",
ephemeral: true,
});
}
} else {
return;
}
if (interaction.isButton()) {
const button = client.buttons.get(interaction.customId);
if (!button) return;

try {
await button.execute(interaction);
} catch (error) {
console.error(error);
await interaction.reply({
content: "There was an error while executing the button script !",
ephemeral: true,
});
}
} else {
return;
}
I was thinking something like this inside the interactionCreate.js file. But how would I actually access the button calls inside a different buttons directory? Help please
6 replies