22 lines
841 B
JavaScript
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);
|
|
}); |