.
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"
|
"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": {
|
"http-signature": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
|
||||||
|
@ -1733,6 +1738,14 @@
|
||||||
"js-tokens": "3.0.2"
|
"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": {
|
"micromatch": {
|
||||||
"version": "2.3.11",
|
"version": "2.3.11",
|
||||||
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz",
|
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz",
|
||||||
|
@ -1773,6 +1786,11 @@
|
||||||
"mime-db": "1.30.0"
|
"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": {
|
"minimatch": {
|
||||||
"version": "3.0.4",
|
"version": "3.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||||
|
@ -2522,6 +2540,17 @@
|
||||||
"streamify": "0.2.9"
|
"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": {
|
"zero-fill": {
|
||||||
"version": "2.2.3",
|
"version": "2.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/zero-fill/-/zero-fill-2.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/zero-fill/-/zero-fill-2.2.3.tgz",
|
||||||
|
|
|
@ -19,7 +19,8 @@
|
||||||
"request-promise": "^4.2.2",
|
"request-promise": "^4.2.2",
|
||||||
"stringify-object": "^3.2.1",
|
"stringify-object": "^3.2.1",
|
||||||
"winston": "^2.4.0",
|
"winston": "^2.4.0",
|
||||||
"youtube-dl": "^1.12.2"
|
"youtube-dl": "^1.12.2",
|
||||||
|
"ytdl-core": "^0.18.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-cli": "^6.26.0",
|
"babel-cli": "^6.26.0",
|
||||||
|
|
|
@ -2,8 +2,9 @@ import { logger } from "../log.js";
|
||||||
import { getLevel } from "../admin.js";
|
import { getLevel } from "../admin.js";
|
||||||
|
|
||||||
const colors = {
|
const colors = {
|
||||||
red: "\x0304$1\x0F",
|
red: "\x0304$1\x0304",
|
||||||
blue: "\x0312$1\x0F"
|
blue: "\x0312$1\x0312",
|
||||||
|
yellow: "\x0308$1\x0308"
|
||||||
};
|
};
|
||||||
|
|
||||||
const replaceColor = (match, color, text) => {
|
const replaceColor = (match, color, text) => {
|
||||||
|
@ -159,8 +160,8 @@ export class irc {
|
||||||
}
|
}
|
||||||
format(msg) {
|
format(msg) {
|
||||||
return msg
|
return msg
|
||||||
.replace(/\[b\](.*?)\[\/b\]/g, "\x02$1\x0F") // bold
|
.replace(/\[b\](.*?)\[\/b\]/g, "\x02$1\x02") // bold
|
||||||
.replace(/\[i\](.*?)\[\/i\]/g, "\x1D$1\x0F") // italic
|
.replace(/\[i\](.*?)\[\/i\]/g, "\x1D$1\x1D") // italic
|
||||||
.replace(/\[color=(.*?)](.*?)\[\/color\]/g, replaceColor) // colors
|
.replace(/\[color=(.*?)](.*?)\[\/color\]/g, replaceColor) // colors
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,11 @@ export class tg {
|
||||||
account: tmp.from.id.toString()
|
account: tmp.from.id.toString()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
self: {
|
||||||
|
me: {
|
||||||
|
nickname: "Uwe"
|
||||||
|
}
|
||||||
|
},
|
||||||
message: tmp.text,
|
message: tmp.text,
|
||||||
time: tmp.date,
|
time: tmp.date,
|
||||||
raw: tmp,
|
raw: tmp,
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
const util = require("util")
|
const fs = require("fs")
|
||||||
, fs = require("fs")
|
, ytdl = require("ytdl-core");
|
||||||
, ytdl = require("youtube-dl");
|
|
||||||
|
|
||||||
const _args = [
|
const _args = [
|
||||||
"--no-progress",
|
"--no-progress",
|
||||||
"--no-warnings",
|
"--no-warnings",
|
||||||
"--no-check-certificate",
|
"--no-check-certificate",
|
||||||
|
"--dump-json"
|
||||||
//"--max-filesize 500m",
|
//"--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") {
|
if(e.network === "n0xy" && e.channel === "#kbot-dev") {
|
||||||
const links = e.message.match(/https?:\/\/[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?/gi);
|
const links = e.message.match(/https?:\/\/[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?/gi);
|
||||||
Promise.all(links.map(link => checkRepost(link))) // repostcheck
|
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(link => ytdl(link, _args)))) // info holen
|
||||||
.then(
|
.then(res => {
|
||||||
res => Promise.all(res.map(t => { e.reply(t.res); return t.link; })),
|
res.forEach(info => {
|
||||||
err => Promise.all(err.map(t => { e.reply(t.err); return t.link; }))
|
e.reply(info);
|
||||||
)
|
});
|
||||||
.then(link => {
|
})
|
||||||
e.reply(`link: ${link}`);
|
.catch(err => {
|
||||||
|
e.reply(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,13 +39,4 @@ function checkRepost(link) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
resolve(link);
|
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(" ");
|
let args = e.message.trim().split(" ");
|
||||||
args.shift();
|
args.shift();
|
||||||
args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0];
|
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