我只是想知道如何在有人尝试在其他频道中使用批量删除命令时批量删除一个频道,而忽略其余频道。
答案 0 :(得分:1)
只需在要批量删除的频道上调用bulkDelete
。
例如,此代码可用于使!bulkdelete #channel
(提及频道)批量删除#channel
中的消息:
client.on('message', message => {
if (message.content.startsWith('!bulkdelete') {
const channel = message.mentions.channels.first()
// you can also bulk delete a news (announcement) channel so if you need to cater for
// those use if (channel.type !== 'text' && channel.type !== 'news')
if (channel.type !== 'text') {
// you can't bulk delete a voice (or store) channel
return
}
channel.bulkDelete()
}
})