Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require('discord.js');
- const PREFIX = 'e?';
- const fs = require("fs");
- const botconfig = require("./botconfig.json");
- const bot = new Discord.Client({disableEveryone: true});
- bot.commands = new Discord.Collection();
- const token = 'NjIyMzU4OTY1NzU3NjczNDcy.XX4UZg.cj8uJezQIUmdg7LksPEUOHRDLD4';
- bot.on('ready', () => {
- console.log('Ionel e pe zona!');
- bot.user.setActivity("e?help | with DublinBOT", { type: "WATCHING" });
- bot.user.setStatus('Do Not Disturb')
- })
- fs.readdir("./commands/", (err, files) => {
- if(err) console.log(err);
- let jsfile = files.filter(f => f.split(".").pop() === "js")
- if(jsfile <= 0){
- console.log("Commands not found");
- return;
- };
- jsfile.forEach((f, i) =>{
- let props = require(`./commands/${f}`);
- console.log(`${f} loaded!`);
- bot.commands.set(props.help.name, props);
- })
- })
- bot.on('message', async message =>{
- if(message.author.bot) return;
- if(message.channel.type === "dm") return;
- let prefix = botconfig.prefix;
- let messageArray = message.content.split(" ");
- let cmd = messageArray[0];
- let args = messageArray.slice(1);
- let commandfile = bot.commands.get(cmd.slice(prefix.length));
- if(commandfile) commandfile.run(bot,message,args);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement