discord.io icon indicating copy to clipboard operation
discord.io copied to clipboard

Purge Messages

Open LexusSpeed03 opened this issue 5 years ago • 3 comments

Is it possible with discord io to purge like 10-20 messages? I am trying to clear a channel before it sends messages but the documentation is very scarce on this.

LexusSpeed03 avatar Apr 04 '19 23:04 LexusSpeed03

.deleteMessages({channelID: "123", messageIDs: ["456", "789"]})

It's in the docs.

cloudrac3r avatar Apr 05 '19 00:04 cloudrac3r

.deleteMessages({channelID: "123", messageIDs: ["456", "789"]})

It's in the docs.

By chance have a link maybe I am looking at the wrong thing? I am trying to have a command where it deletes last like 100 messages in a channel.

LexusSpeed03 avatar Apr 05 '19 05:04 LexusSpeed03

@LexusSpeed03

Discord.io doesn't have a builtin option to delete the last 100 messages.

What you can instead do is use bot.getMessages() and get last 100 messages. Then make an array of their ids and then use bot.deleteMessages() to delete all of them.

Reference:

  1. bot.getMessages()
  2. bot.deleteMessages()

SagnikPradhan avatar Apr 05 '19 14:04 SagnikPradhan