Hello, I have a problem with my db when I make my command I have this error that appears, db.query is not a function
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
const db = require("../../utils/database");
module.exports = {
data: new SlashCommandBuilder()
.setName("lock")
.setDescription("Verrouille le salon")
.addChannelOption((option) =>
option.setName("salon").setDescription("Salon").setRequired(true)
)
.addStringOption((option) =>
option
.setName("reason")
.setDescription("Raison du lock")
.setRequired(true)
),
async execute(interaction) {
try {
console.log(db)
const channel = interaction.options.getChannel("salon");
const reason = interaction.options.getString("reason");
await db.query(`SELECT * FROM lockchannel WHERE GuildID = "${interaction.guild.id}" AND channel = "${channel.id}"`, (err, req) => {
if(req.length > 1) {
return interaction.reply({
content: `> Le salon ${channel} est déjà verrouillé .`,
ephemeral: true,
});
}
if(req.length < 1) {
const role = interaction.guild.roles.cache.find(
(role) => role.name === "@everyone"
);
channel.permissionOverwrites.edit(role, {
SendMessages: false,
});
const msg = new EmbedBuilder()
.setTitle(
":cadenasverrouille: || Salon verrouillé"
)
.setColor("Red")
.setFields(
{
name: `__** || Vérrouillé par**__`,
value: `<@${interaction.user.id}>`,
},
{
name: `__** || Raison**__`,
value: `${reason}`,
}
)
.setFooter({
text: "Katsuki",
iconURL: interaction.guild.iconURL()
? interaction.guild.iconURL()
: "https://imgur.com/a06O1Wn.png",
})
.setTimestamp();
db.query(`INTERT INTO lockchannel (GuildID, userID, channel, reason) VALUES ("${interaction.guild.id}", "${interaction.user.id}", "${channel.id}", "${reason.replace(/"/g, '\\"')}")`)
channel.send({ embeds: [msg] });
}
})
} catch (e) {
console.log(e);
}
},
};