updates
This commit is contained in:
parent
096ec47313
commit
0b604acaae
10 changed files with 3404 additions and 0 deletions
50
bot/index.js
Normal file
50
bot/index.js
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
const Discord = require('discord.js');
|
||||
const botConfig = require('./botconfig.json');
|
||||
const client = new Discord.Client();
|
||||
const fs = require("fs");
|
||||
|
||||
client.commands = new Discord.Collection();
|
||||
|
||||
fs.readdir("./commands/", (err, files) => {
|
||||
if(err) console.log(err);
|
||||
var jsFiles = files.filter(f => f.split(".").pop() === "js");
|
||||
if(jsFiles.length <= 0) {
|
||||
console.log("No files found");
|
||||
return;
|
||||
}
|
||||
jsFiles.forEach((f, i) =>{
|
||||
var fileGet = require(`./commands/${f}`);
|
||||
console.log(`Command Loaded > ${f}`);
|
||||
|
||||
client.commands.set(fileGet.help.name, fileGet)
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
client.on("ready", async () => {
|
||||
console.log(`Logged in as ${client.user.tag}!`);
|
||||
client.user.setStatus('available')
|
||||
client.user.setPresence({
|
||||
game: {
|
||||
name: 'MC-Hostingwijzer.nl',
|
||||
type: "PLAYING",
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
client.on("message", async message => {
|
||||
|
||||
if(message.author.bot) return;
|
||||
if(message.channel.type === "dm") return;
|
||||
var prefix = botConfig.prefix;
|
||||
if (!message.content.startsWith(prefix)) return;
|
||||
var messageArray = message.content.split(" ");
|
||||
var command = messageArray[0];
|
||||
var arguments = messageArray.slice(1);
|
||||
var commands = client.commands.get(command.slice(prefix.length));
|
||||
if (commands) commands.run(client,message, arguments)
|
||||
});
|
||||
|
||||
|
||||
|
||||
client.login(botConfig.token);
|
||||
Loading…
Add table
Add a link
Reference in a new issue