javascript - 有没有办法将 discord.js 消息发送到特定频道?
问题描述
我找到了这个,但它不起作用并说发送未定义。有谁知道为什么?
client.channels.cache.get("channelidwashere").send(sellembed1)
解决方案
如果我没记错的话,您尝试发送消息的方式已过时
尝试这个:
const channel = await client.channels.fetch('youridhere');
await channel.send(embed1);
编辑:我从这里的文档中得到它:https: //discord.js.org/#/docs/main/stable/class/ChannelManager client.channels 返回一个ChannelManager,所以你应该能够调用你找到的方法在本页面。
推荐阅读
- javascript - 使用 mongoose 查询 mongodb 集合以获取正则表达式
- mysql - mysql 检查讲师是否可以在选定的时间上课
- javascript - 如何在javascript中查看函数的构造函数属性?
- java - 扩展 GuiceApplicationLoader 时出错:未绑定 play.Application 的实现。同时定位play.Application
- tensorflow - 使用可馈送迭代器正确使用 `tf.contrib.data.prefetch_to_device()`
- jquery - jQuery找到孩子的第一个孩子
- r - Foreach 循环 - 找不到对象
- css - CSS占位符动画 - 如何处理“可选”状态
- javascript - JavaScript 回调混淆行为
- ios - swift-Tableview 单元格 UIButton 背景颜色