Meh code
Never
const Discord = require("discord.js"); const client = new Discord.Client(); const config = require("./config.json"); client.on("ready", () => { console.log(`Bot has started, with ${client.users.size} users, in ${client.channels.size} channels of ${client.guilds.size} guilds.`); client.user.setActivity(`&help`); }); client.on("guildCreate", guild => { console.log(`New guild joined: ${guild.name} (id: ${guild.id}). This guild has ${guild.memberCount} members!`); client.user.setActivity(`&help`); }); client.on("guildDelete", guild => { console.log(`I have been removed from: ${guild.name} (id: ${guild.id})`); client.user.setActivity(`&help`); }); client.on("message", async message => { if(message.author.bot) return; if(message.content.indexOf(config.prefix) !== 0) return; const args = message.content.slice(config.prefix.length).trim().split(/ +/g); const command = args.shift().toLowerCase(); if(command === "ping") { const m = await message.channel.send("Ping?"); m.edit(`Pong! Latency is ${m.createdTimestamp - message.createdTimestamp}ms. API Latency is ${Math.round(client.ping)}ms`); console.log(`${message.author.tag} used "ping" command.`); client.channels.get("581634085580046337").send(`${message.author.tag} used "ping" command.`); } if(command === "say") { const sayMessage = args.join(" "); message.delete().catch(O_o=>{}); message.channel.send(sayMessage); console.log(`${message.author.tag} used "say" command. Check #deleted-messages-log to see the original message. `); client.channels.get("581634085580046337").send(`${message.author.tag} used "say" command. Check #deleted-messages-log to see the original message.`); } if(command === "kick") { if(!message.member.roles.some(r=>["Kick"].includes(r.name)) ) return message.reply("Sorry, you don't have permissions to use this!"); let member = message.mentions.members.first() || message.guild.members.get(args[0]); if(!member) return message.reply("Please mention a valid member of this server"); if(!member.kickable) return message.reply("I cannot kick this user! Do they have a higher role? Do I have kick permissions?"); let reason = args.slice(1).join(' '); if(!reason) reason = "No reason provided"; await member.kick(reason) .catch(error => message.reply(`Sorry ${message.author} I couldn't kick because of : ${error}`)); message.reply(`${member.user.tag} has been kicked by ${message.author.tag} because: ${reason}`); console.log(`${message.author.tag} used "kick" command. ${member.user.tag} has been banned by ${message.author.tag} because: ${reason} `); client.channels.get("581634085580046337").send(`${message.author.tag} Used the "kick" command. ${member.user.tag} has been kicked by ${message.author.tag} because: ${reason}`); } if(command === "ban") { if(!message.member.roles.some(r=>["Ban"].includes(r.name)) ) return message.reply("Sorry, you don't have permissions to use this!"); let member = message.mentions.members.first(); if(!member) return message.reply("Please mention a valid member of this server"); if(!member.bannable) return message.reply("I cannot ban this user! Do they have a higher role? Do I have ban permissions?"); let reason = args.slice(1).join(' '); if(!reason) reason = "No reason provided"; await member.ban(reason) .catch(error => message.reply(`Sorry ${message.author} I couldn't ban because of : ${error}`)); message.reply(`${member.user.tag} has been banned by ${message.author.tag} because: ${reason}`); console.log(`${message.author.tag} used "ban" command. ${member.user.tag} has been banned by ${message.author.tag} because: ${reason} `); client.channels.get("581634085580046337").send(`${message.author.tag} Used the "ban" command. ${member.user.tag} has been banned by ${message.author.tag} because: ${reason}`); } if(command === "purge") { const deleteCount = parseInt(args[0], 10); if(!message.member.roles.some(r=>["Purge"].includes(r.name)) ) return message.reply("Sorry, you don't have permissions to use this!"); if(!deleteCount || deleteCount < 2 || deleteCount > 100) return message.reply("Please provide a number between 2 and 100 for the number of messages to delete"); const fetched = await message.channel.fetchMessages({limit: deleteCount}); message.channel.bulkDelete(fetched) .catch(error => message.reply(`Couldn't delete messages because of: ${error}`)); console.log(`${message.author.tag} used "purge" command`); client.channels.get("581634085580046337").send(`${message.author.tag} Used the "purge" command. Check #deleted-messages-log to see what was deleted.`); } if(command === "help") { const embed = { "title": "Help page", "description": "Instructions on how to use the help page.", "url": "http://evassmat.com/E1NA", "color": 6426396, "timestamp": "2019-05-24T22:29:16.837Z", "footer": { "icon_url": "https://cdn.discordapp.com/avatars/575438664092614681/af5efd297565070e123727ac3ea84a8e.png?size=1024", "text": "Happy to help! -Diesel#9524" }, "author": { "name": "Mr Help", "url": "http://evassmat.com/E1NA", "icon_url": "https://cdn.discordapp.com/embed/avatars/0.png" }, "fields": [ { "name": "First, you need to know:", "value": "Yes, We do use Adfly. The bot you are currently using is a free version. We use Adfly to generate money off of free bots. If you would like to remove Adfly and just have a direct link to the website message Diesel#9524 and ask about payment options." }, { "name": "Second, you should also know:", "value": "Adfly is a place full of scam advertisment. BECAREFULL!!! DO NOT EVER allow notifications or click anything besides skip ad in the top right corner!" }, { "name": "I think thats about all! Below is the link and you can continue on!", "value": "http://evassmat.com/E1NA" } ] }; message.channel.send("Getting your help page...........", { embed }); console.log(`${message.author.tag} used Help command`); client.channels.get("581634085580046337").send(`${message.author.tag} Used the "help" command`); } }); client.login(config.token);