javascript - (node:199408) DeprecationWarning: Collection#find: 传递一个函数
问题描述
嗨,我是编码新手,想知道我的代码会通过传递函数更改为什么,而不是这里是我已经存在的错误代码
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");
推荐阅读
- android - 不推荐使用 getDownloadUrl,那么如何访问我上传到 Firebase 存储的图像的 URL?
- c++ - VS2017 中的 SDL2 可能的链接问题
- excel - 如何使用shellexecute打印包含多个工作表的exceldocument
- javascript - 在命中服务器端业务逻辑之前捕获刷新事件
- java - 如何在 Tomcat Maven 插件中更改 Tomcat 版本?
- packer - 默认打包机root用户密码
- swift - Swift:如何指定用于静态方法调用的类候选
- ios - 如何获得 MobileVLCKit 的缓冲区百分比?
- python - 如何将 scrapy 与我的烧瓶应用程序集成?
- gatsby - 我无法在 netlify 中访问我的环境变量