.
This commit is contained in:
parent
6f8145c5aa
commit
fdafc44044
29
package-lock.json
generated
29
package-lock.json
generated
@ -1431,6 +1431,11 @@
|
||||
"whatwg-encoding": "1.0.3"
|
||||
}
|
||||
},
|
||||
"html-entities": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/html-entities/-/html-entities-1.2.1.tgz",
|
||||
"integrity": "sha1-DfKTUfByEWNRXfueVUPl9u7VFi8="
|
||||
},
|
||||
"http-signature": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
|
||||
@ -1733,6 +1738,14 @@
|
||||
"js-tokens": "3.0.2"
|
||||
}
|
||||
},
|
||||
"m3u8stream": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/m3u8stream/-/m3u8stream-0.2.1.tgz",
|
||||
"integrity": "sha512-kESIvCcoDOZ2ozD6wGxB962E24nPLDTezIBdqfJH1HxoY/dMTRFXOfq7sXtqPQM3nQihKXlv6pYmUpf01S/tVQ==",
|
||||
"requires": {
|
||||
"miniget": "1.1.0"
|
||||
}
|
||||
},
|
||||
"micromatch": {
|
||||
"version": "2.3.11",
|
||||
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz",
|
||||
@ -1773,6 +1786,11 @@
|
||||
"mime-db": "1.30.0"
|
||||
}
|
||||
},
|
||||
"miniget": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/miniget/-/miniget-1.1.0.tgz",
|
||||
"integrity": "sha512-ICBPQWEoz19eyPHbXLkvjPi62xLhz2irltks35NCYqzYHO0/35IbAaBP3Bbc4VgAwmloIPEpK7CO4/omOiUfDg=="
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||
@ -2522,6 +2540,17 @@
|
||||
"streamify": "0.2.9"
|
||||
}
|
||||
},
|
||||
"ytdl-core": {
|
||||
"version": "0.18.2",
|
||||
"resolved": "https://registry.npmjs.org/ytdl-core/-/ytdl-core-0.18.2.tgz",
|
||||
"integrity": "sha512-mkQ8ZkIJvFG4XJUlrWW1l5c+USotkFcnI6OiRxYO4mRy6rvvL+jZkDs2ntKgacDb56bi7EkvoBiZ+kMR3MHXDA==",
|
||||
"requires": {
|
||||
"html-entities": "1.2.1",
|
||||
"m3u8stream": "0.2.1",
|
||||
"miniget": "1.1.0",
|
||||
"sax": "1.2.4"
|
||||
}
|
||||
},
|
||||
"zero-fill": {
|
||||
"version": "2.2.3",
|
||||
"resolved": "https://registry.npmjs.org/zero-fill/-/zero-fill-2.2.3.tgz",
|
||||
|
@ -19,7 +19,8 @@
|
||||
"request-promise": "^4.2.2",
|
||||
"stringify-object": "^3.2.1",
|
||||
"winston": "^2.4.0",
|
||||
"youtube-dl": "^1.12.2"
|
||||
"youtube-dl": "^1.12.2",
|
||||
"ytdl-core": "^0.18.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-cli": "^6.26.0",
|
||||
|
@ -2,8 +2,9 @@ import { logger } from "../log.js";
|
||||
import { getLevel } from "../admin.js";
|
||||
|
||||
const colors = {
|
||||
red: "\x0304$1\x0F",
|
||||
blue: "\x0312$1\x0F"
|
||||
red: "\x0304$1\x0304",
|
||||
blue: "\x0312$1\x0312",
|
||||
yellow: "\x0308$1\x0308"
|
||||
};
|
||||
|
||||
const replaceColor = (match, color, text) => {
|
||||
@ -159,8 +160,8 @@ export class irc {
|
||||
}
|
||||
format(msg) {
|
||||
return msg
|
||||
.replace(/\[b\](.*?)\[\/b\]/g, "\x02$1\x0F") // bold
|
||||
.replace(/\[i\](.*?)\[\/i\]/g, "\x1D$1\x0F") // italic
|
||||
.replace(/\[b\](.*?)\[\/b\]/g, "\x02$1\x02") // bold
|
||||
.replace(/\[i\](.*?)\[\/i\]/g, "\x1D$1\x1D") // italic
|
||||
.replace(/\[color=(.*?)](.*?)\[\/color\]/g, replaceColor) // colors
|
||||
;
|
||||
}
|
||||
|
@ -53,6 +53,11 @@ export class tg {
|
||||
account: tmp.from.id.toString()
|
||||
})
|
||||
},
|
||||
self: {
|
||||
me: {
|
||||
nickname: "Uwe"
|
||||
}
|
||||
},
|
||||
message: tmp.text,
|
||||
time: tmp.date,
|
||||
raw: tmp,
|
||||
|
@ -1,13 +1,13 @@
|
||||
const util = require("util")
|
||||
, fs = require("fs")
|
||||
, ytdl = require("youtube-dl");
|
||||
const fs = require("fs")
|
||||
, ytdl = require("ytdl-core");
|
||||
|
||||
const _args = [
|
||||
"--no-progress",
|
||||
"--no-warnings",
|
||||
"--no-check-certificate",
|
||||
"--dump-json"
|
||||
//"--max-filesize 500m",
|
||||
'-o "./tmp/%(title)s.%(ext)s"'
|
||||
//'-o "./tmp/%(title)s.%(ext)s"'
|
||||
];
|
||||
|
||||
|
||||
@ -21,13 +21,14 @@ module.exports = bot => {
|
||||
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_info(link, _args)))) // info holen
|
||||
.then(
|
||||
res => Promise.all(res.map(t => { e.reply(t.res); return t.link; })),
|
||||
err => Promise.all(err.map(t => { e.reply(t.err); return t.link; }))
|
||||
)
|
||||
.then(link => {
|
||||
e.reply(`link: ${link}`);
|
||||
.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);
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -38,13 +39,4 @@ function checkRepost(link) {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(link);
|
||||
});
|
||||
}
|
||||
|
||||
function ytdl_info(link, args) {
|
||||
return new Promise((resolve, reject) => {
|
||||
ytdl.getInfo(link, args, (err, res) => {
|
||||
if(err) reject({ link: link, err: err });
|
||||
if(res) resolve({ link: link, res: res });
|
||||
});
|
||||
});
|
||||
}
|
@ -146,7 +146,7 @@ module.exports = bot => {
|
||||
let args = e.message.trim().split(" ");
|
||||
args.shift();
|
||||
args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0];
|
||||
e.reply(`Assuming [b]${args[0]}'s[/b] gender... they're a ${data.genders[~~(Math.random() * data.genders.length)]}.`);
|
||||
e.reply(`Assuming [b]${args[0]}'s[/b] gender... it's a ${data.genders[~~(Math.random() * data.genders.length)]}.`);
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user