如何使用 discord.js 从频道中删除一些消息?我将数字作为delete
命令的参数,但我不知道如何实际删除它。我已经查看了其他问题,我看到的代码开始时channel.fetchMessages
由于某种原因不再是一个函数。这是我目前拥有的代码:channel.fetchMessages({ limit: num }).then(messages => channel.bulkDelete(messages));
问问题
94 次
2 回答
0
啊,好吧,我找到了。它是channel.messages.fetch({ limit: num }).then(messages => channel.bulkDelete(messages));
于 2020-06-12T08:20:12.530 回答
0
msg.channel.bulkDelete(num)
.then(messages => {msg.channel.send(`** \`${messages.size}/${num}\` messages deleted successfully** `)}).then(msg => msg.delete({timeout: 10000}))
it is also shows the count of deleted messages
if you don't want it this would be enough:
msg.channel.bulkDelete(num)
于 2020-10-25T11:50:17.930 回答