fu
All checks were successful
fetch npm modules / f0ck the f0cker (push) Successful in 21s

This commit is contained in:
Flummi
2024-01-03 14:47:22 +01:00
parent 64943719da
commit f32d712dff
3 changed files with 11 additions and 38 deletions

View File

@ -32,11 +32,17 @@ export default async bot => {
if(e.message.match(/\!i(gnore)?\b/))
return false;
if(!e.channel.includes("f0ck") && !e.message.match(/\!f(0ck)?\b/i))
if(!e.channel.includes("f0ck") && (!e.message.match(/\!f(0ck)?\b/i) && (typeof e.raw.forward_from == 'undefined')))
return false;
if(e.type === 'tg' && !e.message.match(/\!f(0ck)?\b/i))
//if(e.type === 'tg' && !e.message.match(/\!f(0ck)?\b/i) && typeof e.raw.forward_from == 'undefined')
// return false;
if(e.type === 'tg' &&
!e.message.match(/\!f(0ck)?\b/i) &&
!e.raw.forward_date
) {
return false;
}
console.log(`parsing ${links.length} link${links.length > 1 ? "s" : ""}...`);
@ -57,7 +63,7 @@ export default async bot => {
// read metadata
let ext;
try {
const meta = JSON.parse((await queue.exec(`yt-dlp -f 'bv*[height<=1080]+ba/b[height<=1080] / wv*+ba/w' --skip-download --dump-json "${link}"`)).stdout);
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);
ext = meta.ext;
} catch(err) {
const tmphead = (await fetch(link, { method: "HEAD" })).headers["content-type"];
@ -77,7 +83,7 @@ export default async bot => {
const start = new Date();
let source;
try {
source = (await queue.exec(`yt-dlp -f 'bv*[height<=1080]+ba/b[height<=1080] / wv*+ba/w' "${link}" --max-filesize ${maxfilesize / 1024}k --postprocessor-args "ffmpeg:-bitexact" -o "./tmp/${uuid}.%(ext)s" --print after_move:filepath --merge-output-format "mp4"`)).stdout.trim();
source = (await queue.exec(`yt-dlp -f 'bv*[height<=720]+ba/b[height<=720] / wv*+ba/w' "${link}" --max-filesize ${maxfilesize / 1024}k --postprocessor-args "ffmpeg:-bitexact" -o "./tmp/${uuid}.%(ext)s" --print after_move:filepath --merge-output-format "mp4"`)).stdout.trim();
} catch(err) {
if(e.type == 'tg')
return await e.editMessageText(msg.result.chat.id, msg.result.message_id, "something went wrong lol");