This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fs.readdir(`${__dirname}/commands/`, (err, dirs) => { | |
dirs.forEach(dir => { | |
fs.readdir(`${__dirname}/commands/${dir}`, (error, file) => { | |
let jsfile = file.filter(f => f.split(".").pop() === "js"); | |
jsfile.forEach((f, i) => { | |
let pathx = `./commands/${dir}/${f}`; | |
let props = require(pathx); | |
console.log(`${f} running!`); | |
let cmdn = path.basename(pathx).toString().slice(0, -3); | |
bot.commands.set(cmdn, props); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
delete require.cache[require.resolve(`PATH`)]; | |
/* | |
Specify a string as the filepath. | |
This will clear cache of JSON file (NodeJS). | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let rps = ["scissors", "paper", "rock"]; | |
let i; | |
if(!rps.includes(args[0])) return message.reply("Please choose rock, paper or scissor."); | |
if(args[0].includes("rock")) { | |
i = 2; | |
} | |
if(args[0].includes("paper")) { | |
i = 1; | |
} | |
if(args[0].includes("scissors")) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function intval(integer) { | |
this.integer = integer; | |
this.res = function() { | |
let result; | |
let ints = [0,1,2,3,4,5,6,7,8,9]; | |
let parsedInt; | |
if(isNaN(this.integer) || typeof this.integer !== "number") { | |
result = false; | |
} | |
if(!this.integer.include(ints)) { |