remove !ignore and add !f
All checks were successful
fetch npm modules / f0ck the f0cker (push) Successful in 18s

This commit is contained in:
Flummi 2023-07-28 11:53:13 +02:00
parent 81e7d50a6b
commit 78a2524ce9

View File

@ -21,18 +21,15 @@ export default async bot => {
call: regex.all,
active: true,
f: e => {
const links = e.message.match(regex.all)?.filter(link => !link.includes(cfg.main.url)) || [];
const links = e.message.match(regex.all)?.filter(link => !link.includes(cfg.main.url.domain)) || [];
let repost;
if(e.media)
links.push(e.media);
if(links.length === 0)
return false;
if(e.message.match(/(!|-)ignore/))
return false;
if(!e.channel.includes("f0ck") && !e.message.match(/(!|-)f0ck/i))
if(!e.message.match(/\!f(0ck)?/i))
return false;
console.log(`parsing ${links.length} link${links.length > 1 ? "s" : ""}...`);
@ -52,12 +49,6 @@ export default async bot => {
const maxfilesize = (getLevel(e.user).level > 50 ? cfg.main.maxfilesize * cfg.main.adminmultiplier : cfg.main.maxfilesize);
// read metadata
/*if(!regex.yt.test(link)) {
const tmphead = (await fetch(link, { method: "HEAD" })).headers["content-type"];
if(!Object.keys(cfg.mimes).includes(tmphead))
return;
ext = cfg.mimes[tmphead];
}*/
let ext;
try {
const meta = JSON.parse((await queue.exec(`yt-dlp -f 'bv*[height<=720]+ba/b[height<=720] / wv*+ba/w' --skip-download --dump-json "${link}"`)).stdout);
@ -69,7 +60,7 @@ export default async bot => {
}
if(!Object.values(cfg.mimes).includes(ext?.toLowerCase())) {
return 'mime schmime ' + ext;
return console.log('mime schmime ' + ext);
}
const msg = await e.reply(`[charging the f0cker] downloading: ${uuid}`, {
@ -186,19 +177,19 @@ export default async bot => {
// autotagger
let tags = [];
if(cfg.apis?.nsfw1 && mime.startsWith('image')) {
/*if(cfg.apis?.nsfw1 && mime.startsWith('image')) {
const nsfw = await autotagger.isNSFW(filename, size);
tags.push(nsfw ? 'nsfw' : 'sfw');
if(nsfw)
await queue.tagNSFW(itemid);
else
await queue.tagSFW(itemid);
}
}*/
let outputmsgirc = `[f0cked] link: ${cfg.main.url.full}/${itemid} | size: ${lib.formatSize(size)} | speed: ${speed}`;
let outputmsgtg = `[f0cked] size: ${lib.formatSize(size)} | speed: ${speed}`;
if(tags.length > 0) {
if(tags?.length > 0) {
const tagstr = tags.join(', ');
outputmsgirc += ` | tags: ${tagstr}`;
outputmsgtg += ` | tags: ${tagstr}`;