Question
I'm kind of new to quick.db and I want to make a command to set values for a user by !add <@user> <value>
and when I use !total <@user>
it shows all the values of the user in an embed. I've given my code below. It adds the values to the users but, doesn't show the values.
My Code
} else if (command == 'add'){
const user = message.mentions.users.first() || message.author;
const theID = args[1];
db.get(`claim_${message.guild.id}_${user.id}`);
db.set('ID', theID);
message.channel.send(`Set **${theID}** for **${user.tag}**`);
} else if (command == 'total'){
const user = message.mentions.users.first() || message.author;
const newID = db.get(`claim_${message.guild.id}_${user.id}`);
if (newID === null) newID === '0';
const embed = new Discord.MessageEmbed()
.setTitle('Total')
.setDescription(`${newID}`)
message.channel.send(embed)
}
So basically, you are setting 'ID'
to the db, and not the user data.
To fix this just change db.set('ID', theID);
to db.set(claim_${message.guild.id}_${user.id}, theID);
and then it will save the user data, not 'ID'.