代码如下:
const { words } = require("../../json/words.json")
const args = message.content.split(' ')
const wordss = words.filter(m=> m.includes(args))
if(args > 1 || !wordss) {
message.delete()
} else {
message.react("✅")
}
"../../json/words.json"
中的单词:
{
"words": [
"apple", "ball", "cat", "dog", "earth", "fish", "girl", "house", "ink", "jar", "king", "lock", "moon", "nose", "oat", "pig", "queen", "rope", "shirt", "tea", "umbrella", "vase", "wave", "xylophone", "yolk", "zebra"
]
}
如果消息不是现有的单词,我该如何删除该消息?即使该消息不包含列表中的任何单词(例如,如果该消息是“battle”),该消息仍然不会被删除,而是得到的React。
1条答案
按热度按时间7eumitmz1#
如果要排除所有不包含
words
数组中任何一个单词的消息,则以下内容可能对您有所帮助: