//main.js file const Discord = require('discord.js'); const client = new Discord.Client(); const fs = require('fs'); client.commands = new Discord.Collection(); client.events = new Discord.Collection(); ['command_handler', 'event_handler'].forEach(handler =>{ require(`./handlers/${handler}`)(client, Discord); }) client.login(super secret code) //command_handler.js file const { Client } = require('discord.js'); const fs = require('fs'); module.exports = (client, Discord) =>{ const command_files = fs.readdirSync('./commands/').filter(file => file.endsWith('.js')); for(const file of command_files){ const command = require(`../commands/${file}`); if(command.name){ client.commands.set(command.name, command); } else { continue; } } } //event_handler.js file const fs = require('fs'); module.exports = (client, Discord) =>{ const load_dir = (dirs) =>{ const event_files = fs.readdirSync(`./events/${dirs}`).filter(file => file.endsWith('.js')); for(const file of event_files){ const event = require(`../events/${dirs}/${file}`); const event_name = file.split('.')[0]; client.on(event_name, event.bind(null, Discord, client)); } } ['client', 'guild'].forEach(e => load_dir(e)); } //ready.js (event) module.exports = (Discord, client) =>{ console.log('Greedy Lobster is online :)') client.user.setPresence({ status: "dnd", activity: { name: "my developer code me.", type: "WATCHING" } }) } //message.js (event) module.exports = (Discord, client, message) => { const prefix = '?'; if(!message.content.startsWith(prefix) || message.author.bot) return; const args = message.content.slice(prefix.lenght).split(/ +/); const cmd = args.shift().toLowerCase(); const command = client.commands.get(cmd); if(command) command.execute(client, message, args, Discord); } //help.js (command) module.exports = { name: 'help', description: "This command will provide you with some assistance.", execute(client, message, args, Discord) { const newEmbed = new Discord.MessageEmbed() .setColor('e10600') .setTitle('Greedy Lobster Help Menu') .setURL('discord link') .setDescription('You may see a list of commands with help for them in this embed.') .addFields( {name: 'Useless Commands', value: 'Ping: It is a simple command that does nothing but respond to you with Pong! :ping_pong:'} ) .addFields( {name: 'Less Useless Commands', value: 'Server: It will give you a link to the support server for if you need any extra assistance.'} ) .setFooter('Join the support server for additional help :)') message.channel.send(newEmbed); } } //ping.js (command) module.exports = { name: 'ping', description: "This is a ping command :)", execute(client, message, args, Discord){ message.channel.send('Pong! :ping_pong:'); } } //server.js (command) module.exports = { name: 'server', description: "This will give you a link to the support server!", execute(client, message, args, Discord){ message.channel.send('discord link'); } }