0
votes

I have a message I want our bot to send but, in order to keep the chat clean, I'd like to delete the message that invoked the command: how can I do this?
This is the current code for the message:

if (message.content.toLowerCase().includes("<@botsnumberidhere> what are the numbers")) {
  message.channel.send("This is good, real good.", {
    file: "https://domainforimage.com/image0.jpg" // Or replace with FileOptions object
  });
}
1

1 Answers

0
votes

You can delete the message with Message.delete(). Please note that this will tell Discord that you want to delete the message, but you'll still be able to access the properties of the message variable you previously stored.

if (message.content.toLowerCase().includes("<@botsnumberidhere> what are the numbers")) {
  message.delete(); // You can put it here.
  message.channel.send("This is good, real good.", {
    file: "https://domainforimage.com/image0.jpg"
  });
}