Compare interaction result and DB data

Hi, I want to get DB data to compare it to an interaction result data and I'm lost trying to fix my problem : when I enter a channel that is already saved in my DB my code won't execute the right part My code : https://pastebin.com/yQQtGFFi
7 Replies
d.js toolkit
d.js toolkit11mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
HydrA2F/ミズさん
Bump ? ;-; I compare what's inside the DB and if the server id already exist the bot asks to update IF the channel id is different, if not it say "you have already saved this channel" but this last part never execute I don't know how to compare what's inside DB and inside slash command The code execute normally and i type /setup_channel with a channel that already exists the bot think it's another one (and now I've a DB error)
HydrA2F/ミズさん
dbConnect.end((err) => {
if (err) {
console.error('Error closing MySQL database: ' + err.stack);
return;
}
console.log('Disconnected from MySQL database.');
});
dbConnect.end((err) => {
if (err) {
console.error('Error closing MySQL database: ' + err.stack);
return;
}
console.log('Disconnected from MySQL database.');
});
when can i open the DB ? but when the command is not used for a long time no error will occurred ? idk if there was an inactivity time that auto close it
Yorick
Yorick11mo ago
iirc, createConnection does close the connection after X amount of time of not using it to resolve this i used createPool instead of createConnection and i also used mysql2, idk if that matters https://stackoverflow.com/questions/61945682/is-there-a-way-to-fix-the-mysql-reconnection-issue-in-node-js this explains it better
HydrA2F/ミズさん
thx Qjuh and Yorick ^^ (I'll come back if i have any problem again)
Yorick
Yorick11mo ago
:thumbsup:
Want results from more Discord servers?
Add your server