ja nun
This commit is contained in:
parent
22527d2552
commit
a01f19c644
@ -4,14 +4,14 @@
|
||||
"description": "f0ck, kennste?",
|
||||
"main": "index.mjs",
|
||||
"scripts": {
|
||||
"start": "node --experimental-json-modules --harmony-optional-chaining src/index.mjs",
|
||||
"trigger": "node --experimental-json-modules --harmony-optional-chaining debug/trigger.mjs"
|
||||
"start": "node --experimental-json-modules src/index.mjs",
|
||||
"trigger": "node --experimental-json-modules debug/trigger.mjs"
|
||||
},
|
||||
"author": "Flummi",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cuffeo": "^1.0.6-1",
|
||||
"flumm-fetch-cookies": "^1.3.5",
|
||||
"mariadb": "^2.3.1"
|
||||
"flumm-fetch-cookies": "^1.4.0",
|
||||
"mariadb": "^2.4.2"
|
||||
}
|
||||
}
|
||||
|
0
public/b/.empty
Normal file → Executable file
0
public/b/.empty
Normal file → Executable file
@ -23,11 +23,11 @@ export default async bot => {
|
||||
params.inc.push(name);
|
||||
}
|
||||
|
||||
let vars = params.inc.concat(params.inc.length == 0 ? params.exc : []);
|
||||
let vars = params.inc.concat(params.inc.length === 0 ? params.exc : []);
|
||||
params.inc = new Array(params.inc.length).fill("username like ?");
|
||||
params.exc = new Array(params.inc.length == 0 ? params.exc.length : 0).fill("username not like ?");
|
||||
let where = params.inc.concat(params.exc).join(" || ");
|
||||
let query = `select id, username, mime, size from items ${where.length > 0 ? `where ${where}` : ""} order by rand() limit 1`;
|
||||
const where = params.inc.concat(params.exc).join(" || ");
|
||||
const query = `select id, username, mime, size from items ${where.length > 0 ? `where ${where}` : ""} order by rand() limit 1`;
|
||||
|
||||
const rows = await sql.query(query, vars);
|
||||
if(rows.length === 0)
|
||||
|
@ -9,10 +9,6 @@ const exec = promisify(_exec);
|
||||
|
||||
const regex = /https?:\/\/[\w\S(\.|:|/)]+/gi;
|
||||
|
||||
console.log(
|
||||
lib.calcSpeed(123456, 56432)
|
||||
);
|
||||
|
||||
export default async bot => {
|
||||
|
||||
return [{
|
||||
@ -27,8 +23,14 @@ export default async bot => {
|
||||
});
|
||||
if(links.length === 0)
|
||||
return false;
|
||||
|
||||
if(e.message.match(/(!|-)ignore/))
|
||||
return false;
|
||||
|
||||
e.reply(`parsing ${links.length} link${links.length > 1 ? "s" : ""}...`);
|
||||
if(!e.channel.includes("f0ck") && !e.message.match(/(!|-)f0ck/i))
|
||||
return false;
|
||||
|
||||
//e.reply(`parsing ${links.length} link${links.length > 1 ? "s" : ""}...`);
|
||||
|
||||
links.forEach(async link => {
|
||||
// check repost (link)
|
||||
@ -44,6 +46,8 @@ export default async bot => {
|
||||
|
||||
const filename = `${uuid}.${meta.ext}`;
|
||||
|
||||
e.reply(`downloading ${filename}...`);
|
||||
|
||||
// download data
|
||||
const start = new Date();
|
||||
const source = (await exec(`youtube-dl "${link}" --max-filesize 10000m -o ./tmp/${filename}`)).stdout.trim();
|
||||
@ -70,7 +74,7 @@ export default async bot => {
|
||||
|
||||
const insertq = await sql.query(
|
||||
"insert into items (src, dest, mime, size, checksum, username, userchannel, usernetwork, stamp, active) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
||||
[ link, filename, mime, size, checksum, e.user.username, e.channel, e.network, ~~(new Date() / 1000), 1 ]
|
||||
[ link, filename, mime, size, checksum, e.user.nick || e.user.username, e.channel, e.network, ~~(new Date() / 1000), 1 ]
|
||||
);
|
||||
|
||||
// generate thumbnail
|
||||
@ -88,8 +92,7 @@ export default async bot => {
|
||||
|
||||
e.reply([
|
||||
`title: ${meta.fulltitle}`,
|
||||
`size: ${lib.formatSize(size)}`,
|
||||
`speed: ${lib.calcSpeed(size, end)} (ytdl: ${end})`,
|
||||
`size: ${lib.formatSize(size)} ${lib.calcSpeed(size, end)} (ytdl: ${end})`,
|
||||
`link: ${cfg.main.url}/${insertq.insertId}`
|
||||
]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user