0
votes

On my Discord bot (ran off of Node.js), I am having issues for it deleting message commands, so when a user sends a command, the bot replies. How do I make the bot delete the users message, but keep the bots command? Because this doesn't work:

let cnt = message.content

 if (cnt !== " ") {
   const cn = message.channel
   let channel = message.channel.name
   let guild = message.guild.name
   message.id.delete
   console.log(`${s(guild + ', ' + channel)} | ${w(cnt)}`)
   cn.send(cnt);
 }

(w and s are chalk commands.)

1

1 Answers

1
votes

Fixed.

    let cnt = message.content
    if (cnt !== " ") {
        const cn = message.channel
        message.delete(500) // ?
        let channel = message.channel.name
        let guild = message.guild.name
        console.log(`${s(guild + ', ' + channel)} | ${w(cnt)}`)
        cn.send(cnt);
      }