UNPKG

free-code

Version:

Makes free code for discord.js command/bots

23 lines (22 loc) 820 B
const { Client, Message, MessageEmbed } = require('discord.js'); module.exports = { name: 'clear', aliases: ['purge'], /** * @param {Client} client * @param {Message} message * @param {String[]} args */ run: async (client, message, args) => { if (!args[0]) return message.channel.send('Please specify a number of messages to delete ranging from 1 - 99') if (isNaN(args[0])) return message.channel.send('Numbers are only allowed') if (parseInt(args[0]) > 99) return message.channel.send('The max amount of messages that I can delete is 99') await message.channel.bulkDelete(parseInt(args[0]) + 1) .catch(err => console.log(err)) message.channel.send('Deleted ' + args[0] + " messages.") } }