Files
discordjs-verification-bot/events/interactionCreate.js
T
2024-02-03 21:32:04 +00:00

22 lines
841 B
JavaScript

const { EmbedBuilder, Collection, PermissionsBitField, ChannelType } = require('discord.js');
const client = require('..');
const config = require('../config/config.js');
client.on('interactionCreate', async interaction => {
const slashCommand = client.slashCommands.get(interaction.commandName);
if (interaction.type === 4) {
if (slashCommand.autocomplete) {
const choices = [];
await slashCommand.autocomplete(interaction, choices);
}
}
if (!interaction.type === 2) return;
if (interaction.channel.type === ChannelType.DM) {
return interaction.reply({ content: "This weren't supposed to be used here...", ephemeral: true });
}
if (!slashCommand) return client.slashCommands.delete(interaction.commandName);
await slashCommand.run(client, interaction);
});