1st commit Discord Bot

This commit is contained in:
johnfacey
2021-03-18 13:16:42 -05:00
commit 9ce9e994dc
14 changed files with 375 additions and 0 deletions

39
index.js Normal file
View File

@@ -0,0 +1,39 @@
const fs = require('fs');
const { prefix, token } = require('./config.json');
const Discord = require('discord.js');
const client = new Discord.Client();
client.commands = new Discord.Collection();
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
client.commands.set(command.name, command);
}
var libFlayer = require("./libFlayer.js");
let linkFlayerMap = [];
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on('message', message => {
if (!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).trim().split(/ +/);
const command = args.shift().toLowerCase();
if (!client.commands.has(command)) return;
try {
client.commands.get(command).execute(message, args);
} catch (error) {
console.error(error);
message.reply('there was an error trying to execute that command!');
}
});
console.log("Link Flayer Bot Activating");
client.login(token);
libFlayer.loadFeeds();