mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-11-10 05:00:18 +00:00
Updated interactionCreate event
This commit is contained in:
parent
5df88494b0
commit
b5d5ca1fe6
@ -3,19 +3,35 @@ import Discord from "discord.js";
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'interactionCreate',
|
name: 'interactionCreate',
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
if (!interaction.isCommand()) return;
|
/*if (!interaction.isCommand()) return;*/
|
||||||
|
|
||||||
const commandName = interaction.commandName;
|
|
||||||
const command = client.commands.get(commandName);
|
|
||||||
if (!command) return;
|
|
||||||
const permissions = interaction.channel.permissionsFor(interaction.client.user);
|
const permissions = interaction.channel.permissionsFor(interaction.client.user);
|
||||||
if (!permissions.has('EMBED_LINKS')) return interaction.send(client.messages.noPermsEmbed);
|
if (!permissions.has('EMBED_LINKS')) return interaction.send(client.messages.noPermsEmbed);
|
||||||
|
|
||||||
try {
|
if(interaction.isCommand()){
|
||||||
command.execute(interaction, client, Discord, command);
|
const commandName = interaction.commandName;
|
||||||
} catch (error) {
|
const command = client.commands.get(commandName);
|
||||||
interaction.reply(client.messages.runningCommandFailed);
|
if (!command) return;
|
||||||
console.error(error);
|
|
||||||
|
try {
|
||||||
|
command.execute(interaction, client, Discord, command);
|
||||||
|
} catch (error) {
|
||||||
|
interaction.reply(client.messages.runningCommandFailed);
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
} else if (interaction.isSelectMenu()){
|
||||||
|
|
||||||
|
} else if (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(client.messages.runningCommandFailed);
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user