weniger deps
This commit is contained in:
		@@ -10,12 +10,9 @@
 | 
			
		||||
  "author": "Flummi & jkhsjdhjs",
 | 
			
		||||
  "license": "WTFPL",
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "discord.js": "^11.3.0",
 | 
			
		||||
    "jsdom": "^11.12.0",
 | 
			
		||||
    "long-timeout": "^0.1.1",
 | 
			
		||||
    "pg-promise": "^7.3.2",
 | 
			
		||||
    "stringify-object": "^3.2.1",
 | 
			
		||||
    "winston": "^2.4.0",
 | 
			
		||||
    "ytdl-core": "^0.18.2"
 | 
			
		||||
    "winston": "^2.4.0"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -10,7 +10,6 @@ import irpg from "./irpg";
 | 
			
		||||
import kernel from "./kernel";
 | 
			
		||||
import lastfm from "./lastfm";
 | 
			
		||||
import mcmaniac from "./mcmaniac";
 | 
			
		||||
import parser from "./parser";
 | 
			
		||||
import pr0gag from "./pr0gag";
 | 
			
		||||
import quotes from "./quotes";
 | 
			
		||||
import rape from "./rape";
 | 
			
		||||
@@ -25,6 +24,6 @@ import wttr from "./wttr";
 | 
			
		||||
export default [
 | 
			
		||||
  cfg, chatbot, coins, cookie, core, debug,
 | 
			
		||||
  drugs, help, irpg, kernel, lastfm, mcmaniac,
 | 
			
		||||
  parser, pr0gag, quotes, rape, sandbox, soundcloud,
 | 
			
		||||
  pr0gag, quotes, rape, sandbox, soundcloud,
 | 
			
		||||
  timer, urban, nxy, uwe, wttr
 | 
			
		||||
];
 | 
			
		||||
 
 | 
			
		||||
@@ -1,41 +0,0 @@
 | 
			
		||||
import fs from "fs";
 | 
			
		||||
import ytdl from "ytdl-core";
 | 
			
		||||
 | 
			
		||||
const _args = [
 | 
			
		||||
  "--no-progress",
 | 
			
		||||
  "--no-warnings",
 | 
			
		||||
  "--no-check-certificate",
 | 
			
		||||
  "--dump-json"
 | 
			
		||||
  //"--max-filesize 500m",
 | 
			
		||||
  //'-o "./tmp/%(title)s.%(ext)s"'
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export default bot => {
 | 
			
		||||
  bot._trigger.set("parser", new bot.trigger({
 | 
			
		||||
    call: /https?:\/\/[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?/gi,
 | 
			
		||||
    active: false,
 | 
			
		||||
    clients: ["irc"],
 | 
			
		||||
    f: e => {
 | 
			
		||||
      if(e.network === "n0xy" && e.channel === "#kbot-dev") {
 | 
			
		||||
        const links = e.message.match(/https?:\/\/[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?/gi);
 | 
			
		||||
        Promise.all(links.map(link => checkRepost(link))) // repostcheck
 | 
			
		||||
          .then(res => Promise.all(res.map(link => ytdl(link, _args)))) // info holen
 | 
			
		||||
          .then(res => {
 | 
			
		||||
            res.forEach(info => {
 | 
			
		||||
              e.reply(info);
 | 
			
		||||
            });
 | 
			
		||||
          })
 | 
			
		||||
          .catch(err => {
 | 
			
		||||
            e.reply(err);
 | 
			
		||||
          });
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }));
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
function checkRepost(link) {
 | 
			
		||||
  return new Promise((resolve, reject) => {
 | 
			
		||||
    resolve(link);
 | 
			
		||||
  });
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user