Discord.js 如何修复(节点:1024)未处理的PromisejectionWarning:TypeError:无法读取属性';包括';nodejs中未定义的

Discord.js 如何修复(节点:1024)未处理的PromisejectionWarning:TypeError:无法读取属性';包括';nodejs中未定义的,discord.js,Discord.js,错误来自此行: if (!args[1].includes("m","h","d","mo","y")) return message.channel.send("That is not a vaild time.") 我试过: if (!args[1].includes(["m","h","d",&qu

错误来自此行:

    if (!args[1].includes("m","h","d","mo","y")) return message.channel.send("That is not a vaild time.")
我试过:

  if (!args[1].includes(["m","h","d","mo","y"])) return message.channel.send("That is not a vaild time.")

但是它也不起作用

你可以只做
args.includes
,我相信args[1]会以不同的方式返回

欢迎使用StackOverflow,请将你的代码作为
args[1]
未定义你可以检查args是否是一个数组,如果它是一个数组,你可以在访问索引之前检查它的长度是否大于等于2:args[1]