Value undefined after SQL database initiation

const joinMessage = await interaction.channel.send({ embeds: [joinEmbed], components: [row] });

// Defined value
// console.log(joinMessage.id)

const db = await new sqlite3.Database("arg.db");
const updateSql = `
UPDATE System
SET variableName = ?
SET variableData = ?
`;

// Undefined value
// console.log(joinMessage.id)

try {
// Undefined value
await db.run(updateSql, [
"joinMessageId",
joinMessage.id
]);
resolve();
} catch (error) {
reject(error);
}
const joinMessage = await interaction.channel.send({ embeds: [joinEmbed], components: [row] });

// Defined value
// console.log(joinMessage.id)

const db = await new sqlite3.Database("arg.db");
const updateSql = `
UPDATE System
SET variableName = ?
SET variableData = ?
`;

// Undefined value
// console.log(joinMessage.id)

try {
// Undefined value
await db.run(updateSql, [
"joinMessageId",
joinMessage.id
]);
resolve();
} catch (error) {
reject(error);
}
I may be going crazy, But joinMessage.id is undefined anywhere after I open the database. Anyone whose fucked around with sql Is there some reason thats happening?
5 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!
Kiɾʌ Kenjiɾø
Kiɾʌ KenjiɾøOP10mo ago
other than the comments thats the part with the error in. It's the only code in the event
Kiɾʌ Kenjiɾø
Kiɾʌ KenjiɾøOP10mo ago
Sorry about the wait, I was playin lethal pff
Svitkona
Svitkona10mo ago
erm, that isn't running in a Promise context why are you using resolve() and reject() ?
d.js docs
d.js docs10mo ago
To share long code snippets, use a service like gist, sourcebin, starbin, or similar instead of posting them as large code blocks or files.
Want results from more Discord servers?
Add your server