javascript - message.author.dmChannel.awaitMessages 不起作用
问题描述
我有一个设置命令,设置发生在 DM 中。发送第一条消息有效,但每当我 dm 机器人时,它都不会检测到我的消息。代码:
const filter = m => m.content;
message.author.dmChannel.awaitMessages(filter, {
max: 1,
time: 60000,
errors: ["time"]
}).then(collected => {
collected.reply("message collected message");
}.catch(() => message.author.send("ran out of time message")
当时间用完时,它会向我发送时间用完消息
我也试过这个,但也没有用
const filter = m => m.content;
message.author.dmChannel.awaitMessages({
filter,
max: 1,
time: 60000,
errors: ["time"]
}).then(collected => {
collected.reply("message collected message");
}.catch(() => message.author.send("ran out of time message")
解决方案
TextChannel.awaitMessages()
现在只需要 1 个参数。这包括对象中的过滤器属性。将其更改为此将起作用:
const filter = m => m.content;
message.author.dmChannel.awaitMessages({
filter,
max: 1,
time: 60000,
errors: ["time"]
})
推荐阅读
- ansible - 使用 Ansible 复制模块进行远程到远程文件传输(同一远程主机)
- php - 如何在 octobrcms 中显示用户的所有帖子
- jquery - Django ajax 更新模型
- c# - 如何将 RestSharp 响应添加到 API 控制器?
- ansible - 如何对用户/组存在进行 Ansible 条件测试?
- reactjs - 大型模块化 React+Redux 应用程序中捆绑包之间松散耦合的策略是什么
- c++ - 使用文件描述符移动对象
- java - 不兼容的类型 - 泛型接口和实现
- php - PHP 中的网络爬虫无法在 mysql 数据库中创建记录。怎么修?
- python - 从串口接收到的数据发送到 MySQL