Josh P
Josh P

Reputation: 61

How to use deleteMessage to get a Discord bot to clear a messge after () minutes

{
setTimeout(function()
{
   deleteMessage()
}, 120000);
}

Trying to get my bot to delete a message after () minutes of it being sent what would I use to do this. If needed, the library I used was https://github.com/hydrabolt/Discord.JS

Upvotes: 1

Views: 9136

Answers (2)

Josh P
Josh P

Reputation: 61

bot.on("message", function(message)
  {
  setTimeout(function()
  {
  bot.deleteMessage(message)
  }, 120000);
});

This is what it ended up looking like, thank you Joundill for the help.

Upvotes: 2

Joundill
Joundill

Reputation: 7533

I suggest using this function in a setTimeout, like you currently have.

http://discordjs.readthedocs.io/en/latest/docs_client.html#deletemessage-message-options-callback

Upvotes: 1

Related Questions