mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2025-04-19 10:44:47 +00:00
42 lines
1.4 KiB
JavaScript
42 lines
1.4 KiB
JavaScript
import Discord from "discord.js";
|
|
|
|
module.exports = {
|
|
name: 'interactionCreate',
|
|
async execute(client, interaction) {
|
|
/*if (!interaction.isCommand()) return;*/
|
|
|
|
const permissions = interaction.channel.permissionsFor(interaction.client.user);
|
|
if (!permissions.has('EMBED_LINKS')) return interaction.send(client.messages.noPermsEmbed);
|
|
|
|
if(interaction.isCommand()){
|
|
const commandName = interaction.commandName;
|
|
const command = client.commands.get(commandName);
|
|
if (!command) return;
|
|
|
|
try {
|
|
command.execute(interaction, client, Discord, command);
|
|
} catch (error) {
|
|
interaction.reply({
|
|
content: client.messages.runningCommandFailed,
|
|
ephemeral: true
|
|
});
|
|
console.error(error);
|
|
}
|
|
} else if (interaction.isSelectMenu() || interaction.isButton()){
|
|
const commandName = interaction.customId;
|
|
const command = client.commands.get(commandName);
|
|
if (!command) return;
|
|
|
|
try {
|
|
command.execute(interaction, client, Discord, command);
|
|
} catch (error) {
|
|
interaction.reply({
|
|
content: client.messages.runningCommandFailed,
|
|
ephemeral: true
|
|
});
|
|
console.error(error);
|
|
}
|
|
}
|
|
}
|
|
}
|