// events/interactionCreate.js const { InteractionContextType, PermissionFlagsBits, SlashCommandBuilder, MessageFlags } = require('discord.js'); const conn = require('../../../database/db'); // Ajusta o caminho module.exports = { name: 'interactionCreate', async execute(interaction, client) { if (interaction.isAutocomplete()) { const focusedValue = interaction.options.getFocused(); console.log(focusedValue); if (interaction.commandName === 'wdd') { try { const [rows] = await conn.execute( 'SELECT name,value FROM choices LIMIT 25', [`%${focusedValue}%`] ); const suggestions = rows.map(row => ({ name: row.name, value: row.value, })); await interaction.respond(suggestions); } catch (err) { console.error('Erro ao buscar sugestões:', err); await interaction.respond([]); } } } }, };