Reputation: 63
I can't seem to figure out how to delete messages in a channel with a specified amount. ex: p.command 15. deletes 15 messages.
Upvotes: 0
Views: 12814
Reputation: 61
I am assuming you mean a sort of purge command.
let messagecount = parseInt(numberofmessages);
message.channel.fetchMessages({ limit: messagecount })
.then(messages => message.channel.bulkDelete(messages));
numberofmessages
is the number of messages you want to delete. You can replace it with another variable or argument.
Upvotes: 6