Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bot.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("Aucun fichier de commande !")
- return;
- }
- jsFiles.forEach((f,i) =>{
- var fileGet = require("./commands/" + f);
- console.log("Fichier de commande " + f + " récupéré avec succès !")
- bot.commands.set(fileGet.help.name, fileGet)
- });
- });
- bot.on("ready", async () =>{
- console.log(" ")
- console.log("Connecté en tant que : " + bot.user.tag)
- bot.user.setActivity("!help | TutoBot", {type: "PLAYING"});
- });
- bot.on("message", message =>{
- if(message.author.bot) return;
- if(message.channel.type === "dm") return;
- var prefix = config.prefix;
- var messageArray = message.content.split(" ");
- var command = messageArray[0];
- var args = messageArray.slice(1)
- var commands = bot.commands.get(command.slice(prefix.length))
- if(commands) commands.run(bot, message, args);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement