Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const botconfig = require("./botconfig.json");
- const Discord = require("discord.js");
- const fs = require("fs");
- const bot = new Discord.Client();
- bot.commands = new Discord.Collection();
- let purple = botconfig.purple;
- let cooldown = new Set();
- let cdseconds = 5;
- //////////////////////////////////////////////
- // TODO-LIST:
- /////////////////////////////////////////////
- // -add embed colors
- // -make help cmd
- // -add custom embed in /utils/embed.js
- // -Cooldown error embed
- //
- //
- //
- //
- ////////////////////////////////////////////
- fs.readdir("./commands/", (err, files) => {
- if(err) console.log(err);
- let jsfile = files.filter(f => f.split(".").pop() === "js");
- if(jsfile.length <= 0){
- console.log("Couldn't find commands.");
- return;
- }
- console.log(` `)
- console.log(` `)
- console.log(` `)
- console.log(` `)
- console.log(` /$$$$$$$ /$$ /$$ `)
- console.log(` | $$__ $$| $$ |__/ `)
- console.log(` | $$ \ $$| $$ /$$$$$$ /$$ /$$ /$$ /$$$$$$/$$$$ /$$$$$$ /$$$$$$ `)
- console.log(` | $$$$$$$/| $$ /$$__ $$| $$ /$$/| $$| $$_ $$_ $$ |____ $$ /$$__ $$`)
- console.log(` | $$____/ | $$| $$$$$$$$ \ $$$$/ | $$| $$ \ $$ \ $$ /$$$$$$$| $$ \__/`)
- console.log(` | $$ | $$| $$_____/ >$$ $$ | $$| $$ | $$ | $$ /$$__ $$| $$ `)
- console.log(` | $$ | $$| $$$$$$$ /$$/\ $$| $$| $$ | $$ | $$| $$$$$$$| $$ `)
- console.log(` |__/ |__/ \_______/|__/ \__/|__/|__/ |__/ |__/ \_______/|__/ `)
- console.log(` `)
- console.log(`============== Booting Bot... ================`)
- console.log(' ')
- console.log('Booting version: 1.9 Stable')
- console.log(' ')
- console.log(`============== Loading commands... ================`)
- console.log(' ')
- jsfile.forEach((f, i) =>{
- let props = require(`./commands/${f}`);
- console.log(`- ${f} succesfully loaded!`);
- bot.commands.set(props.help.name, props);
- });
- });
- bot.on("ready", async () => {
- console.log(' ')
- console.log(`============== Login in... ================`)
- console.log(' ')
- console.log(`${bot.user.username} is logged in succesfully on: ${bot.guilds.size} servers!`);
- bot.user.setActivity("on pleximar.de", {type: "WATCHING"});
- });
- bot.on("message", async message => {
- if(message.author.bot) return;
- if(message.channel.type === "dm") return;
- let prefix = botconfig.prefix;
- if(!message.content.startsWith(prefix)) return;
- if(cooldown.has(message.author.id)){
- message.delete();
- return message.reply("You have to wait 5 seconds between commands.")
- }
- if(!message.member.hasPermission("ADMINISTRATOR")){
- cooldown.add(message.author.id);
- }
- 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);
- setTimeout(() => {
- cooldown.delete(message.author.id)
- }, cdseconds * 1000)
- });
- bot.login(botconfig.token);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement