I have a function that is called by using
console.log(getGuildChance(message.guild.id));
and it keeps returning Promise { undefined }
, here is the function:
async function getGuildChance(guildId) {
let db = new sqlite.Database('./servers.db', sqlite.OPEN_READWRITE | sqlite.OPEN_CREATE)
let query = `SELECT * FROM servers WHERE serverid = ?`;
db.get(query, [guildId], (err, row) => {
if (err) {
console.log(err)
return;
}
return row.chance;
});
}
im a bit lost on what to do, ive already tried using promises but i cant seem to get it. please help and thank you in advance