0

db.push(message.author.id), "item"用来做这个。

这是用于制作游戏,但如果用户不拥有该特定项目,我希望它不运行代码。

4

1 回答 1

0

使用db.has(message.author.id + '.items.weapons')示例

你可以在npm 网站上看到更多

你做了什么 :

// Pushing an element to an array (that doesn't exist yet) in an object:
db.push(message.author.id + '.items', 'Sword')
// -> { items: ['Sword'] }

以及你应该做什么来查看元素是否存在

db.has(message.author.id + '.items')
于 2020-09-15T09:52:31.680 回答