Discord 我试图通过某个关键字找到频道,该关键字可以位于频道名称的任何位置

Discord 我试图通过某个关键字找到频道,该关键字可以位于频道名称的任何位置,discord,discord.js,Discord,Discord.js,就像我们有message.content.includes,是否还有包含关键字giveaway的频道? 我得到的错误代码非常明显 let GChannel = message.guild.channels.cache.find((x) => (x.name.includes === "giveaway")) if (!GChannel) message.reply("Giveaway Channel Found") GChannel.s

就像我们有
message.content.includes
,是否还有包含关键字giveaway的频道? 我得到的错误代码非常明显

let GChannel = message.guild.channels.cache.find((x) => (x.name.includes === "giveaway"))
    if (!GChannel) message.reply("Giveaway Channel Found")
   GChannel.send("Hello")
像机器人一样,应该找到包含赠品的频道名称。这样做有什么好处吗

Thank是一个函数,而不是字符串,因此必须作为函数调用

让gcchannel=message.guild.channels.cache.find((x)=>x.name.includes(“赠品”))

不起作用。我刚刚测试了TypeError:x.name.includes.includes不是函数对不起,那是我的打字错误。删除第一个
包含项
工作:()()(()()()()()()()()40。如果我的答案解决了您的问题,请确保将其标记为已接受,以便将来与您有共同问题的人更容易找到答案。
> GChannel.send("Hello")
>              ^ TypeError: Cannot read property 'send' of undefined