Reputation: 55
I just want to know how i can bulk delete only one channel and ignore the rest of the channels whenever someone tries to use the bulk delete command in a different channel.
Upvotes: 0
Views: 291
Reputation: 14148
Simply call bulkDelete
on the channel that you want to bulk delete.
For example, this code can be used to make !bulkdelete #channel
(mentioning the channel) bulk delete the messages in #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()
}
})
Upvotes: 1