discord.js clean content
snippet in javascript

discord.js clean content

user7187

//if you purposely searched CLEAN CONTENT, then here's an example I use.
//Usually used when awaiting a message from a user IF the answer isn't supposed to be specific like "Yes" or "No"

 let txt1 = args.join(' ')

 if (collected.first(txt1)) {
                      let text1 = collected.first().cleanContent
                      
                     return message.channel.send(text1);
                      }

discord js clear message

user3450

client.on('message', function(message) {
    if (message.content == "^clear") {
        if (message.member.hasPermission("MANAGE_MESSAGES")) {
            message.channel.fetchMessages()
               .then(function(list){
                    message.channel.bulkDelete(list);
                }, function(err){message.channel.send("ERROR: ERROR CLEARING CHANNEL.")})                        
        }
    }

});