简体   繁体   中英

DISCORD.JS how to purge delete messages?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM