mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2025-07-02 00:23:38 +00:00
TypeScript Initial
This commit is contained in:
45
src/client/events/interactionCreate.ts
Normal file
45
src/client/events/interactionCreate.ts
Normal file
@ -0,0 +1,45 @@
|
||||
import { PermissionFlagsBits } from "discord.js";
|
||||
|
||||
module.exports = {
|
||||
name: 'interactionCreate',
|
||||
async execute(client, interaction) {
|
||||
|
||||
const permissions = interaction.channel.permissionsFor(interaction.client.user);
|
||||
if (!permissions.has(PermissionFlagsBits.ViewChannel)) return;
|
||||
|
||||
if (!permissions.has(PermissionFlagsBits.EmbedLinks)) return interaction.reply({
|
||||
content: client.messageEmojis["error"] + client.messages.noPermsEmbed,
|
||||
ephemeral: true
|
||||
});
|
||||
|
||||
if(interaction.isChatInputCommand()){
|
||||
const commandName = interaction.commandName;
|
||||
const command = client.commands.get(commandName);
|
||||
if (!command) return;
|
||||
|
||||
try {
|
||||
command.execute(interaction, client);
|
||||
} catch (error) {
|
||||
interaction.reply({
|
||||
content: client.messageEmojis["error"] + client.messages.runningCommandFailed,
|
||||
ephemeral: true
|
||||
});
|
||||
console.error(error);
|
||||
}
|
||||
} else if (interaction.isStringSelectMenu() || interaction.isButton()){
|
||||
const commandName = interaction.customId;
|
||||
const command = client.commands.get(commandName);
|
||||
if (!command) return;
|
||||
|
||||
try {
|
||||
command.execute(interaction, client, command);
|
||||
} catch (error) {
|
||||
interaction.reply({
|
||||
content: client.messageEmojis["error"] + client.messages.runningCommandFailed,
|
||||
ephemeral: true
|
||||
});
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user