This commit is contained in:
parent
64943719da
commit
f32d712dff
@ -1,32 +0,0 @@
|
||||
import db from '../src/inc/sql.mjs';
|
||||
import lib from '../src/inc/lib.mjs';
|
||||
|
||||
import readline from 'node:readline/promises';
|
||||
|
||||
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
||||
|
||||
const newuser = process.argv[2]?.length ? process.argv[2] : await rl.question('username: ');
|
||||
const password = await rl.question('password: ');
|
||||
const level = +(await rl.question('level (0-100): '));
|
||||
|
||||
rl.close();
|
||||
|
||||
if(!newuser.length || !password.length) {
|
||||
console.log('nope lol');
|
||||
process.exit();
|
||||
}
|
||||
|
||||
const id = (await db`
|
||||
insert into "user" ${
|
||||
db({
|
||||
login: newuser.toLowerCase(),
|
||||
user: newuser,
|
||||
password: await lib.hash(password),
|
||||
level: level >= 0 && level <= 100 ? level : 0
|
||||
})
|
||||
}
|
||||
returning id
|
||||
`)[0]?.id;
|
||||
|
||||
console.log(`created new user ${newuser} with ID ${id}`);
|
||||
process.exit();
|
@ -10,8 +10,7 @@
|
||||
"autotagger": "node debug/autotagger.mjs",
|
||||
"thumbnailer": "node debug/thumbnailer.mjs",
|
||||
"test": "node debug/test.mjs",
|
||||
"clean": "node debug/clean.mjs",
|
||||
"adduser": "node debug/adduser.mjs"
|
||||
"clean": "node debug/clean.mjs"
|
||||
},
|
||||
"author": "Flummi",
|
||||
"license": "MIT",
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user