//Chris Lodge /* Packages used +-- discord.js@11.5.1 | +-- long@4.0.0 | +-- prism-media@0.0.3 | +-- snekfetch@3.6.4 | +-- tweetnacl@1.0.1 | `-- ws@6.2.1 | `-- async-limiter@1.0.1 +-- ffmpeg@0.0.4 | `-- when@3.7.8 +-- mysql@2.17.1 | +-- bignumber.js@7.2.1 | +-- readable-stream@2.3.6 | | +-- core-util-is@1.0.2 | | +-- inherits@2.0.4 | | +-- isarray@1.0.0 | | +-- process-nextick-args@2.0.1 | | +-- safe-buffer@5.1.2 deduped | | +-- string_decoder@1.1.1 | | | `-- safe-buffer@5.1.2 deduped | | `-- util-deprecate@1.0.2 | +-- safe-buffer@5.1.2 | `-- sqlstring@2.3.1 `-- ytdl-core@1.0.0 +-- html-entities@1.2.1 +-- m3u8stream@0.6.2 | +-- miniget@1.6.1 deduped | `-- sax@1.2.4 deduped +-- miniget@1.6.1 `-- sax@1.2.4 */ const Discord = require('discord.js'); const client = new Discord.Client(); const auth = require('./auth.json'); const https = require('https'); const http = require('http'); var mysql = require('mysql'); const ytdl = require('ytdl-core'); var con = mysql.createConnection({ host: "", user: "", password: "", database: "" }); con.connect(function(err) { if (err) throw err; console.log("Connected!"); }); function longSend(msg,txt){ let toSend=[]; while(txt.length>1800){ toSend.push(txt.substring(0,1800)); txt=txt.substring(1800); } toSend.push(txt); toSend.forEach(function(item,index,array){ msg.reply(item); }); } function isAdmin(msg){ if(msg.member.hasPermission("ADMINISTRATOR")){ return true; }else{ msg.reply("You should not be doing that"); return false; } } function magicEight(msg){ let outcomes=["It is certain","It is decidedly so","Without a doubt","Yes - definitely", "You may rely on it","As I see it, yes","Most likely","Outlook good","Yes", "Signs point to yes","Reply hazy, try again","Ask again later","Better not tell you now", "Cannot predict now","Concentrate and ask again","Don't count on it","My reply is no", "My sources say no","Outlook not so good","Very doubtful"]; res=Math.floor(Math.random()*20); msg.reply(outcomes[res]); } function getFact(msg){ https.get('https://uselessfacts.jsph.pl/random.txt', (resp) => { let content = ''; resp.on('data', (chunk) => { content += chunk; }); resp.on('end', () => { msg.reply(content.substr(1)); }); }); } function getJoke(msg){ https.get('https://icanhazdadjoke.com/', (resp) => { let content = ''; resp.on('data', (chunk) => { content += chunk; }); resp.on('end', () => { var b=content.indexOf('
'); var e=content.indexOf('