const { CommandInteraction, ApplicationCommandAutoComplete , InteractionType, Events} = require("discord.js");
module.exports = {
name: "interactionCreate",
async execute(interaction, client) {
if(interaction.type == InteractionType.ApplicationCommandAutocomplete){
const {commands} = client;
const {commandName} = interaction;
const command = commands.get(commandName);
if (!command) return;
try {
await command.autocomplete(interaction, client)
} catch (error){
console.error(error);
}
}
client.on(Events.InteractionCreate, async interaction => {
if (!interaction.isModalSubmit()) return;
if (interaction.customId === 'customDinoModal') {
await interaction.reply({ content: 'Nome do dino enviado a database.' });
}
});
},
};
const { CommandInteraction, ApplicationCommandAutoComplete , InteractionType, Events} = require("discord.js");
module.exports = {
name: "interactionCreate",
async execute(interaction, client) {
if(interaction.type == InteractionType.ApplicationCommandAutocomplete){
const {commands} = client;
const {commandName} = interaction;
const command = commands.get(commandName);
if (!command) return;
try {
await command.autocomplete(interaction, client)
} catch (error){
console.error(error);
}
}
client.on(Events.InteractionCreate, async interaction => {
if (!interaction.isModalSubmit()) return;
if (interaction.customId === 'customDinoModal') {
await interaction.reply({ content: 'Nome do dino enviado a database.' });
}
});
},
};