Skip to content
This repository has been archived by the owner on Mar 25, 2020. It is now read-only.

Purge Messages #312

Open
LexusSpeed03 opened this issue Apr 4, 2019 · 3 comments
Open

Purge Messages #312

LexusSpeed03 opened this issue Apr 4, 2019 · 3 comments

Comments

@LexusSpeed03
Copy link

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.

@cloudrac3r
Copy link

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

It's in the docs.

@LexusSpeed03
Copy link
Author

.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.

@SagnikPradhan
Copy link

@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()

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants