While trying to create a database for my node.js discord bot, I set the key to the discord users username, and set the value to a inputed value, but when I try to access the the key it logs that the value is Promise { <pending> }
I was wondering what may be the reason why this is happening. My code:
if(message.content.startsWith('s!promote') && message.author.username === 'akatech'){
let user = message.content.split(' ').slice(1).join(' ')
const Embed = new EmbedBuilder()
.setColor('#FFD1DC')
.setTitle('User promotion')
.setAuthor({ name: `${client.user.username}`, iconURL: "https://cdn.discordapp.com/attachments/1092494309678403646/1131227307244269638/88dc8ffb83f583354a8f0e344d7ce353.webp", url: 'https://starstructbot.repl.co' })
.setDescription('**' + user + '** has been promoted!!')
.setTimestamp()
let msg = await message.channel.send({ embeds: [Embed] })
msg.react('🥳')
msg.react('🎉')
msg.react('🎊')
db.set(`${user}`, "1").then(() => {
message.channel.send(`${db.get(user)}`)
console.log(db.get(`${user}`))
})
}
Thanks in advance!