I use db.push(message.author.id), "item"
for doing this.
This is for making a game but I want it to not running the code if the user does not own that specific item.
I use db.push(message.author.id), "item"
for doing this.
This is for making a game but I want it to not running the code if the user does not own that specific item.
Use db.has(message.author.id + '.items.weapons')
for examlple
You can see more in the npm website
What you did :
// Pushing an element to an array (that doesn't exist yet) in an object:
db.push(message.author.id + '.items', 'Sword')
// -> { items: ['Sword'] }
And what you should do to see if the element exists
db.has(message.author.id + '.items')