/wdd - Versão final a funcionar com mysql :)

This commit is contained in:
Bxio 2025-04-05 11:45:30 +01:00
parent 028afde436
commit ab48ac6220
2 changed files with 3 additions and 1 deletions

View File

@ -3,6 +3,7 @@ const { InteractionContextType, PermissionFlagsBits, SlashCommandBuilder, Messag
console.error("--------------------- teste.js ---------------------"); console.error("--------------------- teste.js ---------------------");
module.exports = { module.exports = {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()

View File

@ -2,6 +2,7 @@
const { InteractionContextType, PermissionFlagsBits, SlashCommandBuilder, MessageFlags } = require('discord.js'); const { InteractionContextType, PermissionFlagsBits, SlashCommandBuilder, MessageFlags } = require('discord.js');
const conn = require('../../../database/db'); // Ajusta o caminho const conn = require('../../../database/db'); // Ajusta o caminho
module.exports = { module.exports = {
name: 'interactionCreate', name: 'interactionCreate',
async execute(interaction, client) { async execute(interaction, client) {
@ -14,7 +15,7 @@ module.exports = {
const [rows] = await conn.execute( const [rows] = await conn.execute(
'SELECT name,value FROM choices LIMIT 25', 'SELECT name,value FROM choices LIMIT 25',
[`%${focusedValue}%`] [`%${focusedValue}%`]
); );
const suggestions = rows.map(row => ({ const suggestions = rows.map(row => ({
name: row.name, name: row.name,