daily pastebin goal
27%
SHARE
TWEET

Untitled

a guest May 16th, 2018 107 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. bot.commands.set(props.help.name, props);
  2.                                     ^
  3.  
  4. TypeError: Cannot read property 'name' of undefined
  5.     at jsfiles.forEach (D:loriB Discord botbot.js:22:37)
  6.     at Array.forEach (<anonymous>)
  7.     at fs.readdir (D:loriB Discord botbot.js:19:13)
  8.     at FSReqWrap.oncomplete (fs.js:135:15)
  9. [nodemon] app crashed - waiting for file changes before starting...
  10.    
  11. const Discord = require("discord.js");
  12. const settings = require("./settings.json");
  13. const prefix = settings.prefix;
  14. const fs = require("fs");
  15.  
  16. const bot = new Discord.Client();
  17. bot.commands = new Discord.Collection();
  18.  
  19. fs.readdir("./commands/", (err, files) => {
  20.     if(err) console.error(err);
  21.  
  22.     let jsfiles = files.filter(f => f.split(".").pop() === "js");
  23.     if(jsfiles.length <= 0) {
  24.         console.log("Nincsenek betölteni való parancsok!");
  25.         return;
  26.     }
  27.     console.log(`Betöltök ${jsfiles.length} parancsot!`);
  28.  
  29.     jsfiles.forEach((f, i) => {
  30.         let props = require(`./commands/${f}`);
  31.         console.log(`${i + 1}: ${f} betöltve!`);
  32.             bot.commands.set(props.help.name, props);
  33.  
  34.         });
  35.     });
  36.    
  37. module.exports.run = async (bot, message, args) => {
  38.     console.log("it works");
  39. }
  40.  
  41. module.exports.help = {
  42.     name: "avatar"
  43. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top