(节点:199408)DeprecationWarning:Collection#find:改为传递一个函数
(node:199408) DeprecationWarning: Collection#find: pass a function instead
大家好,我是编码新手,想知道通过传递函数我的代码会变成什么,而不是这里是我已经存在的代码,但有错误
let reportschannel = message.guild.channels.find(`name`, "reports");
以下是您可能会觉得有用的文档:https://discord.js.org/#/docs/main/stable/class/Collection?scrollTo=find
因此,您的代码将变为:
let reportschannel = message.guild.channels.find(channel => channel.name === "reports");
大家好,我是编码新手,想知道通过传递函数我的代码会变成什么,而不是这里是我已经存在的代码,但有错误
let reportschannel = message.guild.channels.find(`name`, "reports");
以下是您可能会觉得有用的文档:https://discord.js.org/#/docs/main/stable/class/Collection?scrollTo=find
因此,您的代码将变为:
let reportschannel = message.guild.channels.find(channel => channel.name === "reports");