I want to keep my code clean looking and easier to understand, by putting all the longer stuff in another file. I have my main file (index.js):
const discord = require('discord.js');
require('dotenv').config()
const token = process.env.botToken;
const prefix = "s!";
const cmds = require("./commands.js");
var client = new discord.Client();
client.on('ready', function(message) {});
client.on('message', function(message) {
if(message.author.equals(client.user) || !message.content.startsWith(prefix)) return;
var args = message.content.substring(prefix.length).split(" ");
switch (args[0].toLowerCase()) {
case "help":
cmds.help;
break;
}
});
client.login(token)
and my other folder (commands.js):
const discord = require('discord.js');
var client = new discord.Client();
module.exports = {
help: function(message) {
var embed = new discord.RichEmbed()
.addField("spyBot Commands", "If you get issues, dont be afraid to join us: http://discord.gg/3k6zGNF");
message.channel.send(embed);
}
}
I would like it to send the embed, but when I put the command in, nothing happens and no errors are printed.