Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to make a purge command discord.js

var amount = parseInt(args[0])

        if (!amount) return message.channel.send("Please specify the amount of messages you want me to delete")
        if (amount > 100 || amount < 1) return message.channel.send("Please select a number *between* 100 and 1")

        message.channel.bulkDelete(amount).catch(err => {
              message.channel.send(':x: Due to Discord Limitations, I cannot delete messages older than 14 days') })

        let msg = await message.channel.send(`Deleted `${amount}` messages`)
        setTimeout(() => {
            msg.delete()
        }, 2000)
Comment

discord.js purge

case 'clear':
            if(!args[1]) return message.reply ('Error, please define second argument')
            message.channel.bulkDelete(args[1]);
Comment

PREVIOUS NEXT
Code Example
Javascript :: unicode in javascript 
Javascript :: convert string to integer: 
Javascript :: chart.js 
Javascript :: adding pre tag javascript 
Javascript :: how do you pass props between components 
Javascript :: save or update mongoose 
Javascript :: why does array index start from 0 
Javascript :: javascript get all elements by class starting with 
Javascript :: example of callback function in javascript 
Javascript :: javascript eliminar saltos de linea textarea 
Javascript :: create responsive navbar without javascript 
Javascript :: alertify js examples 
Javascript :: login js 
Javascript :: default function parameters javascript 
Javascript :: upload file in node 
Javascript :: graphql json schema 
Javascript :: python to java script 
Javascript :: javascript error null 
Javascript :: sort array by field 
Javascript :: insertar al inicio de un array javascript 
Javascript :: how to remove a variable from an array javascript 
Javascript :: add a string to list jquery 
Javascript :: top bar in react js 
Javascript :: range between two numbers 
Javascript :: javascript looop 
Javascript :: what is the use of consrtructors in reactjs 
Python :: All caps alphabet as list 
Python :: python today - 1 day 
Python :: ParserError: Error tokenizing data. C error: Expected 1 fields in line 87, saw 2 
Python :: conda install lxml 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =